Login Page - Create Account

Support Board


Date/Time: Sun, 23 Aug 2026 03:54:57 +0000



[Programming Help] - SpreadSheet Entry and Exit formulas

View Count: 302

[2026-07-06 20:33:36]
alexo2022 - Posts: 55
I have trading entry signal, and I need help formulating the stop, target and entry on the spreadsheet

for example when I have signal to enter long,
I want to enter buy limit of the high of the previous bar + 1 tick,
stop will be on the low of the previous bar + 1 tick
and target will be 5 points from entry point.

for short will be the opposite
sell limit at the low of the previous bar + 1 tick
stop will be at the high of the previous bar + 1 tick
and target will be 5 points from entry point.
[2026-07-06 22:21:52]
Sawtooth - Posts: 4348
I want to enter buy limit of the high of the previous bar + 1 tick,
I think you want a Buy Stop instead:
J22: =C4+J21
J71: S

sell limit at the low of the previous bar + 1 tick
I think you want a Sell Stop instead, and -1 tick instead:
J24: =D4-J21
J73: S

target will be 5 points from entry point:
J80: =5
This works for both long and short.
This offset is from the entry, in points, not ticks, and includes slippage if any.
(Check 'Use Attached Orders' on the Trade Window.)

For the Long Stoploss, you'll need to create a persistent value of the Low -1 tick of the signal bar, in a spare Formula Column, e.g. in P3:
=IF(K3=1,D3-$J$21,P4)
Then add the Trade Management by Study study, and reference SG6 of the Spreadsheet System for Trading study, and set 'Position Type' to 'Long Only'.
In J81, set an initial Stoploss offset from entry, and the Trade Management by Study study will move it to the price in P3.

For the Short Stoploss, you'll need to create a persistent value of the High +1 tick of the signal bar, in a spare Formula Column, e.g. in Q3:
=IF(M3=1,C3+$J$21,Q4)
Then add another Trade Management by Study study, and reference SG7 of the Spreadsheet System for Trading study, and set 'Position Type' to 'Short Only'.
In J81, set an initial Stoploss offset from entry, and the Trade Management by Study study will move it to the price in Q3.

Attached Orders: Study Controlled Targets and Stops

If the Buy Stop/Sell Stop doesn't get filled, you need to use one of these examples to cancel it:
Spreadsheet Example Formulas and Usage: Cancel Unfilled Working Order n Minutes After Entry
Spreadsheet Example Formulas and Usage: Cancel an Unfilled Order After n Bars
[2026-07-08 15:34:22]
alexo2022 - Posts: 55
Thank you for your detailed answer.

I'm having difficulty applying the stoploss according to your explanation.

The stoploss should dynamic and based on

Long position - the low of the previous bar - 1 tick.

Short position - the high of the previous bar + 1 tick.

You said to set initial stoploss offset in j81, and i dont know what to value to enter.
[2026-07-08 18:07:50]
Sawtooth - Posts: 4348
You said to set initial stoploss offset in j81, and i dont know what to value to enter.
Enter an offset in points so that the initial stoploss is outside the bar's range plus 1 tick.

This will place the initial stoploss in the market, then the Trade Management by Study study will move it to the price in P3/Q3, in my example.
Date Time Of Last Edit: 2026-07-08 18:10:20
[2026-07-22 14:04:32]
alexo2022 - Posts: 55
the system to connect to prop firm using rhythmic

it only happens when the system is entering long trade, in short trade the system work properly.
while the system enters long trade,

once there a signal ( yellow bar ), there's a bracket with stop, target and entry point. ( pic 1 )
and as the market is triggered at the entry level ( pic 2 )
suddenly the stop is moving to upper location ( pic 3 )


this is the formula I have in column K (Buy Entry) - =IF(AND(ID21.SG1@4=1, R3<=40), 1, 0)

this is the formula I have in column p that is connected to the trade management by study - =IF(K3=1, D4-$J$21, 0)


these are the messages I got in the trade activity log


2026-07-21 09:35:07.156 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:07.318 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:07.490 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:07.826 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:08.011 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:08.220 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:08.444 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:08.611 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:08.804 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:08.997 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:09.309 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:09.486 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:09.660 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:09.868 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:10.073 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:10.260 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:10.518 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:10.689 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:10.932 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:11.090 | Stopping trail order modification due to multiple failed modifications | Symbol: NQU6.CME | TradeAccount: LFE150-H4DLC102-TEST001 | InternalOrderID: 12513 | ServiceOrderID: 166531754 | Current Status: Pending Modify *
2026-07-21 09:35:11.090 | Order modification failed | Rithmic Direct - DTC (Order cancel/replace reject). Info: sell order stop price must be below trade price. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:11.098 | Order modification failed (InternalOrderID) | Unable to modify order because maximum failed modifications has been reached. Limit: 20. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:11.161 | Order modification failed (InternalOrderID) | Unable to modify order because maximum failed modifications has been reached. Limit: 20. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:11.466 | Order modification failed (InternalOrderID) | Unable to modify order because maximum failed modifications has been reached. Limit: 20. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:
2026-07-21 09:35:11.567 | Order modification failed (InternalOrderID) | Unable to modify order because maximum failed modifications has been reached. Limit: 20. Internal Order ID: 12513. Service Order ID: 166531754. Symbol: NQU6.CME. Account:


any ideas how can solve this problem ?
image1. before entring the trade .png / V - Attached On 2026-07-22 13:42:28 UTC - Size: 135.76 KB - 25 views
image2. the trade enterd .png / V - Attached On 2026-07-22 13:42:38 UTC - Size: 126.21 KB - 34 views
image3. the stop moves .png / V - Attached On 2026-07-22 13:42:48 UTC - Size: 132.33 KB - 41 views
[2026-07-22 14:25:48]
John - SC Support - Posts: 47594
Are you using a "Trade Management by Study" study to control the Stop? If so, then that study is trying to move the Stop to a position that is not valid (i.e. it is above the current market price).

You need to look at your "Trade Management by Study" and adjust it so that it handles your Long and Short trades properly. Or, you need to have two different studies and you would need to control them based on whether you are Long or Short. Or, you need to look at the study that is being referenced and make sure that it is setup properly for both situations.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2026-07-22 14:35:48]
alexo2022 - Posts: 55
I'm using 2 "Trade Management by Study"
one is for stop in Long positions
and the other one is for stop in Short Positions

attached is the stop for long settings.

if I will do the stop management using the spreadsheet will be better ?
imageTrade Managment by Study - Long Setting .png / V - Attached On 2026-07-22 14:34:35 UTC - Size: 179.03 KB - 21 views
[2026-07-22 16:31:21]
John - SC Support - Posts: 47594
The Spreadsheet Study can not move a Stop or Target. It only allows you to set the initial position.

The "Trade Management by Study" is used to move Stops or Targets after the trade is in place.

We can not say what may be incorrect about your Trade Management by Study. That is something you need to look into and figure out.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2026-07-22 16:43:42]
alexo2022 - Posts: 55
Is it possible that I see that there are also values in cells 22 and 24 ( see attached pictures ),
and that interrupts the trade management study ?

do I need to erase them?
imageJ22 CELL.png / V - Attached On 2026-07-22 16:43:25 UTC - Size: 74.2 KB - 22 views
imageJ24 CELL.png / V - Attached On 2026-07-22 16:43:32 UTC - Size: 60.55 KB - 33 views
[2026-07-22 17:19:28]
John - SC Support - Posts: 47594
Those are the prices at which a primary Limit or Stop order will be placed from the Spreadsheet System for Trading. Refer to the following:
Spreadsheet Systems, Alerts and Automated Trading: Limit or Stop Prices (read/write) [[v1:J22,v2:J78], [v1:J23,v2:J79], [v1:J24,v2:J80], [v1:J25,v2:J81]

Those are NOT the attached orders prices. And, as we stated, the Spreadsheet System for Trading does not have any control over the attached orders once an order has been entered.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2026-07-22 17:24:20]
alexo2022 - Posts: 55
so what can be the cause for making the stop suddenly change his position up for no reason ( see attached photos )
image1. before entring the trade .png / V - Attached On 2026-07-22 17:23:58 UTC - Size: 135.76 KB - 37 views
image2. the trade enterd .png / V - Attached On 2026-07-22 17:24:05 UTC - Size: 126.21 KB - 40 views
image3. the stop moves .png / V - Attached On 2026-07-22 17:24:14 UTC - Size: 132.33 KB - 32 views
[2026-07-22 18:34:31]
John - SC Support - Posts: 47594
It is your Trade Management by Study. You need to look at what it is doing, and make sure that you are actually activating the correct one.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account