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:49:53
Barry Cunningham
6 hours agoLIVE BREAKING NEWS: President Trump Celebrates Hanukkah! And More News
53.5K11 -
1:29:40
Anthony Rogers
13 hours agoEpisode 394 - Isaac Butterfield
25K1 -
8:02
China Uncensored
12 hours agoChina Just Took The First Step Towards WAR
31.6K17 -
1:20:04
Flyover Conservatives
1 day agoWhy Did Jesus Really Come? It’s NOT What You Think - Pedro Adao | FOC Show
30.9K3 -
2:18:25
DLDAfterDark
4 hours ago $2.55 earnedYo Homie! Is That My Briefcase?? EDC & Gun Talk - Blue Waffle Giveaway Pre Stream
29.1K2 -
1:34:23
Glenn Greenwald
8 hours agoSydney Shooting Exploited for Pro-Israel Censorship and Anti-Muslim Crackdowns; How Media DEI Was the Opposite of Diversity | SYSTEM UPDATE #559
140K127 -
1:09:01
MattMorseTV
7 hours ago $53.39 earned🔴Trump just handed Congress THE EVIDENCE.🔴
56.8K118 -
1:01:54
BonginoReport
9 hours agoVanity Fair Goes Nuclear On Trump’s Inner Circle - Nightly Scroll w/ Hayley Caronia (Ep.198)
153K69 -
53:25
Katie Miller Pod
10 hours ago $9.14 earnedFBI Director Kash Patel & Alexis Wilkins on Balancing Their Relationship with Work | KMP Ep.19
45.1K32 -
1:15:37
Candace Owens
9 hours agoErika And I Sat Down. Here’s What Happened. | Candace Ep 280
226K927