Login Page - Create Account

Support Board


Date/Time: Fri, 14 Mar 2025 22:39:42 +0000



[Programming Help] - (x*ATR)BuyExit/SellExit Not Performing Correctly

View Count: 432

[2022-06-27 14:46:41]
GG - Posts: 20
System is designed to exit when the TP is TP=(x)*ATR and SL=(x)*ATR.

I was playing around with x=4, x=8 and other variables but keep getting the exact same results, indicating my formula must be incorrect.


BuyExit:
=OR(AND($J$8 > 0, ID0.SG4@3 <= $J$9-(ID2.SG1@3*4)), AND($J$8 > 0, ID0.SG4@3 >= $J$9+(ID2.SG1@3*8)))

SellExit:
=OR(AND($J$8 < 0, ID0.SG4@3 >= $J$9+(ID2.SG1@3*4)), AND($J$8 < 0, ID0.SG4@3 <= $J$9-(ID2.SG1@3*8)))

This is meant to be a SL=4, TP=8.


Thanks in advance for your time.
[2022-06-27 17:05:45]
Sawtooth - Posts: 4182
Your formula is fine.

What's the exact same result?
[2022-06-27 18:46:19]
GG - Posts: 20
An example is the sell entry was 4593 and the exit was at 4589.75 when the ATR is 6.08. Then the same result was for when I changed the parameters to TP=(4*ATR).

The price never fell below 4593-(6.08*4) so it shouldn't have signaled a SellExit.



What's more; the Trade Activity Log are identical for both of the following formulas run over 12 years of data on Nasdaq.

SellExit:
=OR(AND($J$8 < 0, ID0.SG4@3 >= $J$9+(ID2.SG1@3*4)), AND($J$8 < 0, ID0.SG4@3 <= $J$9-(ID2.SG1@3*4)))
SellExit:
=OR(AND($J$8 < 0, ID0.SG4@3 >= $J$9+(ID2.SG1@3*4)), AND($J$8 < 0, ID0.SG4@3 <= $J$9-(ID2.SG1@3*8)))

You would think this change would tweak it even slightly if the above example was just a glitch.

Thanks again
[2022-06-27 20:24:28]
Sawtooth - Posts: 4182
Check the Trade Service Log for why a trade happened or not.

You could use the Trading: Position Average Price study instead of cell J9.
It shows historical levels; J9 does not.

You could plot the calculated target and stop values as lines, for verification.
Date Time Of Last Edit: 2022-06-29 13:56:45

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

Login

Login Page - Create Account