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.
-
2:07:47
LFA TV
15 hours agoTHE RUMBLE RUNDOWN LIVE @9AM EST
61.5K5 -
LIVE
I_Came_With_Fire_Podcast
9 hours agoThe Pattern Beneath the World: Nature, The Mark of the Beast, & the Sacred Order
247 watching -
49:56
X22 Report
4 hours agoMr & Mrs X - [DS] Antifa Are Planning An Insurrection,Trump Has Prepared The Counterinsurgency-EP 11
42.5K45 -
1:08:57
Wendy Bell Radio
8 hours agoPet Talk With The Pet Doc
38.5K26 -
8:47
Demons Row
2 days ago $1.45 earnedI Spent $50,000 Building My Dream Harley-Davidson 😳💀 (Learn From My Mistakes)
37.2K9 -
38:18
SouthernbelleReacts
22 hours ago $1.53 earnedThey Thought the Secret Was Buried… But I’m Screaming! | Reaction to I Know What You Did Last Summer
28.7K1 -
29:37
Midwest Crime
1 day ago5 Cops Shot as Minnesota Raid Turns into Chaos
56.8K163 -
31:08
mizery
17 days ago $0.52 earnedI Asked 100 Pros To Help Me Go Pro...
13.8K2 -
7:03:56
FyrBorne
16 hours ago🔴Battlefield 6 Live M&K Gameplay: A Return to Form for This Former Giant
22.2K -
3:40
Danny Rayes
2 days ago $0.81 earnedInfluencers Are Going Broke. What Happened?
9.52K4