Support Board
Date/Time: Wed, 05 Mar 2025 01:23:37 +0000
[Programming Help] - [Spreadsheet Trading] How to lock TP & SL targets to the ATR at that time?
View Count: 549
[2022-01-07 01:36:00] |
tuanluu20902 - Posts: 24 |
Hi guys, Currently, for my spreadsheet system, I calculate TP and SL levels based on a multiples of ATR. For example. my Buy Exit looks something like this: =OR(E3>=($J$9+(4*AC3)),E3<=($J$9-(2*AC3))) where AC3 is the cell of the candle's Average True Range. So as you can see, the strategy is simple, either TP at 4xATR or SL below at 2xATR. My problem is the ATR is constantly changing with every new candle and that means every new candle my TP and SL fluctuate based on the calculations of the new ATR. How do I set it so that the TP and SL is locked to the ATR of the candle when the trade was entered? |
[2022-01-07 04:28:07] |
Sawtooth - Posts: 4179 |
How do I set it so that the TP and SL is locked to the ATR of the candle when the trade was entered?
You need to create a persistent variable of the ATR at the signal candle, like this:=IF(K3,AC3,P4) where the above formula is in P3. Then use this exit formula: =OR(E3>=($J$9+(4*P3)),E3<=($J$9-(2*P3))) |
[2022-01-09 15:53:02] |
tuanluu20902 - Posts: 24 |
Thank you so much for the help Tom!
|
To post a message in this thread, you need to log in with your Sierra Chart account: