Support Board
Date/Time: Sun, 24 Nov 2024 02:35:03 +0000
Trigger a Trade When Another Condition is TRUE Several Bars Earlier
View Count: 162
[2024-07-02 21:25:48] |
Rich_B - Posts: 31 |
Hi I am using the Trading System Based on Alert Condition Study. I can get the following two formulas working correctly independently of each other ... =ID12.SG2 ... triggers a trade entry when the study becomes TRUE =C>H[-1] ... triggers a trade when the candle closes higher than the high of the previous bar I am trying to combine the two but struggling. I think it is because the formula requires both conditions to be true on the same bar. I used this ... =AND(ID12.SG2,(=C>H[-1])) ... but it does not work because both conditions never occur on the same bar. What I want to achieve is ... when the first condition is met, then the first instance of the second condition occurring after that event should trigger the trade entry. This may be several bars later. The formula needs to remember that the first condition has been met and then remain on standby for the second condition to be met, however long that takes. When both are met, the trade entry executes. I'm pretty confident that the above is possible. Any pointers in the right direction much appreciated. Thank you |
[2024-07-02 22:06:19] |
John - SC Support - Posts: 36238 |
You would have to modify the idea at the following link to capture the state of your first condition and then you can implement your second condition based on that. Spreadsheet Example Formulas and Usage: Formula to Count Bars Since An Event For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing |
[2024-07-02 23:35:33] |
Sawtooth - Posts: 4118 |
Any pointers in the right direction much appreciated.
The ID12.SG2 TRUE condition needs to be made persistent, until C>H[-1], then released with another condition.Since you are not using a spreadsheet study, use the Spreadsheet Formula study, like this in its Formula field: =IF(ID12.SG2,1,IF(ReleaseCondition,0,ID13.SG1[-1])) where ID13 is this Spreadsheet Formula study. This will return 1 at every bar since ID12.SG2 was TRUE, until it is released, then it will return 0. Then use this formula for your trade entry: =AND(ID13.SG2,C>H[-1]) |
To post a message in this thread, you need to log in with your Sierra Chart account: