Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 15:12:26 +0000



Post From: Programming - How to Buy/Sell Exit 2*ATR

[2022-06-14 21:25:04]
GG - Posts: 20
System is designed to enter buy if gap from previous day's high to current day's open is larger than 2*ATR. System enters sell if gap from previous day's low to current days open is larger than 2*ATR. I am doing this by referencing OHLC (References Days Back: 1).

BuyEntry
=(J16-ID1.SG2@3)>(ID2.SG1@3*2)

BuyExit (Sell)
=OR(AND(J8 > 0, ID0.SG4@3 <= J9-(ID2.SG1@3*2)), AND(J8 > 0, ID0.SG4@3 >= J9+(ID2.SG1@3*2)))

SellEntry
=(ID1.SG3@3-J16)>(ID2.SG1@3*2)

SellExit (Buy)
=OR(AND(J8 < 0, ID0.SG4@3 >= J9+(ID2.SG1@3*2)), AND(J8 < 0, ID0.SG4@3 <= J9-(ID2.SG1@3*2)))


The Problem:
When replaying past days, Daily Open (J16) = 0. So it sends a SellEntry through every bar. I'm not sure how else to reference Daily Open when my OHLC is set to previous day?


Thanks for your help.