Hi. First of all, thank you for this great, helpful community. This is my first post ever, so please excuse me for any abnormalities.
I searched our forum but have not found a script for the 3 bars play trading strategy yet (see image linked below).
I'm looking to scan any 3 bars formation and then look for entry from a small list of stock options.
The above codes are from @tradecombine (greatly appreciate this). This is the latest code/strategy for this thread (updated on 10/29/21). These codes look professionally done and seem to function much better than mine, so i will be using/testing this from now on.
Any help, suggestion, or advice is greatly appreciated! Thank you!
I searched our forum but have not found a script for the 3 bars play trading strategy yet (see image linked below).
I'm looking to scan any 3 bars formation and then look for entry from a small list of stock options.
Code:
#
#Strategy 3/4/5 Bars Breakout/down
#@tradecombine
input bodyMultiple = 2.0;
input gapMultiple = 0.0;
input volMultiple = 3.0;
input barPercent = .75; # What percentage of the bar must be body to qualify as a 3BP
input margin = 0.10; # how much to allow exceed
def VA = VolumeAvg(30).VolAvg;
#3 Bar Play:
def range3 = high[1] - low[1];
########First Bar:
#The "high" of the bar has to set a new 20 day high (or high of the previous 20 candles for intra day scans)
def bar31 = Highest(high[1], 20)
#Range of the bar has to be greater than the previous 14 bar ATR range
&& range3 > bodyMultiple * ATR(14)
# stock breaks out over range
&& open[1] > high[2] + gapMultiple * ATR(14)
# Volume is higher than average
&& volume[1] > volMultiple * VA
# breakout bar has full body or very close to it
&& (close[1] - open[1]) >= barPercent * (high[1] - low[1])
&& close[1] > open[1];
#######Second Bar:
#The "high" of the bar has to be 'less than or equal to' to high of the previous bar.
def bar32 = high <= high[1] + margin
#The "low" of the bar has to be in the upper 50% range of the first bar.
&& low >= low[1] + (0.5 * range3);
def bar3barplay = bar31 && bar32;
#--------------------------------------#
# 4 Bar Play:
def range4 = high[2] - low[2];
def bar41 = Highest(high[2], 20)
&& range4 > bodyMultiple * ATR(14)
&& open[2] > high[3] + gapMultiple*ATR(14)
&& volume[2] > volMultiple * VA
&& (close[2] - open[2]) >= barPercent * (high[2] - low[2])
&& close[2] > open[2];
def bar42 = high[1] <= high[2] + margin
&& low[1] >= low[2] + (0.5 * range4);
def bar43 = high <= high[2] + margin
&& low >= low[2] + (0.5 * range4);
def bar4barplay = bar41 && bar42 && bar43;
# 5 Bar Play:
def range5 = high[3] - low[3];
def bar51 = Highest(high[3], 20)
&& range5 > bodyMultiple * ATR(14)
&& open[3] > high[4] + gapMultiple*ATR(14)
&& volume[3] > volMultiple * VA
&& (close[3] - open[3]) >= barPercent * (high[3] - low[3])
&& close[3] > open[3];
def bar52 = high[2] <= high[3] + margin
&& low[2] >= low[3] + (0.5 * range5);
def bar53 = high[1] <= high[3] + margin
&& low[1] >= low[3] + (0.5 * range5);
def bar54 = high <= high[3] + margin
&& low >= low[3] + (0.5 * range5);
def bar5barplay = bar51 && bar52 && bar53 && bar54;
plot scan = bar3barplay OR bar4barplay OR bar5barplay;
The above codes are from @tradecombine (greatly appreciate this). This is the latest code/strategy for this thread (updated on 10/29/21). These codes look professionally done and seem to function much better than mine, so i will be using/testing this from now on.
Any help, suggestion, or advice is greatly appreciated! Thank you!
Last edited: