Login Page - Create Account

Support Board


Date/Time: Sun, 12 Jul 2026 18:34:29 +0000



[Programming Help] - SpreadSheet Entry and Exit formulas

View Count: 117

[2026-07-06 20:33:36]
alexo2022 - Posts: 51
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: 4340
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: 51
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: 4340
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

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

Login

Login Page - Create Account