Premium Only Content

Tutorial 204 | Looking for conditions to occur within specified numbers of bars of each other
A Gold Pass asked for a tutorial about how to write a program that looked for three conditions to occur, in order. The first condition should occur, then the second condition should occur within a specified number of bars of the first. Finally a third condition would occur within a certain number of bars of the second.
The occurances being looked for in this show me study are a moving average cross over, a doji and and Bullish Harami. There was no particular logic in picking these specific conditions merely just a way of demonstrating this technique.
In this example the program looks for the moving average cross over. When it found it then looks for a Doji for the next 5 bars. If the Doji is found the program then looks for a Bullish Harami with the next 24 bars. The show me plots every time one of the conditions is found, a green dot for the average cross-over, a blue dot for a Doji and a red dot for a Bullish Harami.
In the strategy version a market order is made when the three conditions have occurred.
The way the program works is by using counters that continually increment. When one of the conditions occurs, the counter for that condition is reset to zero.
Note that the initial values for the counters are set to a level where a condition is erroneously recorded.
It is useful to create a show me study prior to a strategy to ensure that the program is working as anticipated.
-
LIVE
LFA TV
21 hours agoBREAKING NEWS ON LFA TV! | FRIDAY 9/19/25
785 watching -
LIVE
Total Horse Channel
12 hours ago2025 WDAA Western Dressage World Championship Show | Day Four | Arena One
103 watching -
LIVE
The Mike Schwartz Show
5 hours agoTHE MIKE SCHWARTZ SHOW Evening Edition 09-19-2025
4,019 watching -
21:49
Jasmin Laine
5 hours agoCBC Panel TURNS on Liberals—"Carney DOESN'T Know What He’s Doing"!
4.22K21 -
LIVE
Mally_Mouse
2 days agoFriend Friday!! 🎉 - Let's Play! - 🎂 ITS MY BIRTHDAY!!🎂
114 watching -
LIVE
Quite Frankly
5 hours agoFriday Night News & Reviews | Sal The Butcher, Cultivate Elevate 9/19/25
471 watching -
1:28:50
Kim Iversen
4 hours agoThe GOP's Biggest Fear: President AOC?!
100K128 -
1:36:13
Roseanne Barr
5 hours agoCalling Out the Right’s Vultures with Katie Hopkins | The Roseanne Barr Podcast #116
126K78 -
Dr Disrespect
9 hours ago🔴LIVE - DR DISRESPECT - SUPER ENTERTAINMENT POWER
110K11 -
LIVE
Rallied
3 hours ago $0.54 earnedWarzone Challenges All Night
45 watching