Support Board
Date/Time: Thu, 23 Jan 2025 14:36:11 +0000
[Programming Help] - Trading System Based on Alert Cond. Study - what is the formula to delay a trade entry?
View Count: 794
[2018-11-20 20:34:40] |
David Clarke - Posts: 23 |
Hello I use this simple formula in a 'Trading System Based on Alert Condition' Study, to automate trading based on price action crossing a Moving Average - =CROSSFROMBELOW(C,ID1.SG1) How can I code this so that the trade entry triggers, not on the first bar, but on the next / second / [+1] bar? |
[2018-11-20 22:28:38] |
Xfanman1 - Posts: 320 |
Alert the crossover from the prior bar [-1] This way your entry will be in the bar after your crossover. — Scott |
[2018-11-20 23:11:33] |
David Clarke - Posts: 23 |
Thanks for that advice, Scott. I understand that principle, but have a problem incorporating that into a code that works. If this is the code that I am currently using, =CROSSFROMBELOW(C,ID1.SG1) . . . . can you suggest how I could re-write it to achieve my goal. |
[2018-11-21 14:10:26] |
Xfanman1 - Posts: 320 |
David, try this --> =CROSSFROMBELOW(C[-1],ID1.SG1) I tested this (see attached) and it works perfectly on the MA that I referenced. You can see that the bars that first crossed the Yellow/Blue MA do not signal, but the bar that follows (Fuchsia) signals as you wished. -- Scott Date Time Of Last Edit: 2018-11-21 14:13:04
|
CrossoverTestCode.PNG / V - Attached On 2018-11-21 14:10:18 UTC - Size: 46.46 KB - 313 views |
[2018-11-21 18:17:36] |
David Clarke - Posts: 23 |
Scott, many thanks for your help.
|
[2018-11-21 18:24:59] |
Sierra Chart Engineering - Posts: 104368 |
For information, the documentation for how to reference other bars within an alert can be found here: Study/Chart Alerts And Scanning: Referencing Data Other Than on the Last Bar/Column In the Chart Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: