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.
-
10:05
MattMorseTV
7 hours ago $2.97 earnedHe actually did it...
22.2K16 -
1:32:39
Anthony Rogers
1 day agoEpisode 376 - Todd Schowalter
4.32K -
LIVE
megimu32
3 hours agoOTS: Movie Tie-In Games + Remakes: Let’s Play Memory Lane
196 watching -
1:15:06
Adam Does Movies
10 hours ago $0.18 earnedTalking Movies + Ask Me Anything - LIVE
6.19K -
1:17:18
Glenn Greenwald
1 day agoWhat are CBS News' Billionaire Heirs Doing with Bari Weiss? With Ryan Grim on the Funding Behind It; Europe Capitulates to Trump Again | SYSTEM UPDATE #494
94.4K66 -
1:43:49
RiftTV
5 hours agoCNN Calls Black NY Shooter WHITE, Cincinnati FATIGUE | The Rift | Guest: Braeden Sorbo, 2Protects1
37K14 -
4:21:04
LumpyPotatoX2
6 hours agoKilling Floor 3: Rampage & Chaos - #RumbleGaming
9.85K -
LIVE
BrancoFXDC
6 hours ago $0.51 earnedPlaying Ranked Warzone - Pursuit of Diamond Rank
103 watching -
1:11:41
Omar Elattar
6 hours agoThe Brain Experts: "Your Overthinking Problem Has A Physical Solution & We Can Show You!"
13K2 -
4:31:38
Mattnifico
5 hours agoREPLAYING EVERY FORZA HORIZON GAME - Forza Horizon 1 (Part 2)
4.43K