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.
-
1:09:13
Graham Allen
3 hours agoTrump To Address The Nation! + Candace Bends The Knee, The Cult Turns On Her!
50.6K393 -
LIVE
Wendy Bell Radio
6 hours agoIs She Even An American?
6,539 watching -
1:14:09
Chad Prather
16 hours agoHow to Recognize When God Has Already Answered Your Prayer
36.3K21 -
1:33:59
Game On!
20 hours ago $3.05 earnedBIGGEST 2025 College Football Playoff 1st Round BETS NOW!
43.6K2 -
1:04:39
Crypto Power Hour
13 hours ago $6.10 earnedState of Early Stage Crypto Investor Rob Good
66.7K8 -
1:24:24
LIVE WITH CHRIS'WORLD
20 hours agoTHE WAKE UP CALL - 12/17/2025 - Episode 27
42K -
27:51
ThinkStory
21 hours agoIT: WELCOME TO DERRY Season 1 Ending Explained!
46K -
5:29
Gamazda
15 hours ago $2.30 earnedMetallica - Nothing Else Matters (Live Piano in a Church)
31.6K10 -
2:50:56
The Confessionals
23 hours agoHe Killed a Monster (Then They Told Him to Stay Silent)
31.4K16 -
41:42
Brad Owen Poker
18 hours ago $1.25 earnedMy BIGGEST WIN EVER!! $50,000+ In DREAM Session!! Must See! BEST I’ve Ever Run! Poker Vlog Ep 360
21.2K1