Here is a screener that will detect 3 Lines Breakouts. It has to be tuned to fit your needs : change the ScreenerBehavior variable to the value that you target : 1 = bullish breakouts, 0 = bearish breakouts , 2 = all breakouts.
// Change the below variable to change the screener behavior
// 1 = bullish breakouts
// 0 = bearish breakouts
// 2 = all breakouts
once ScreenerBehavior=1
// Trend=0 mean that the current block is red
// Trend=1 mean that the current block is green
once Trend=1
// On each candle the breakout are put to false
Breakout=0
if (close > Chand1PH and Trend=1) then
Chand3PB=Chand2PB
Chand3PH=Chand2PH
Chand2PB=Chand1PB
Chand2PH=Chand1PH
Chand1PB=Chand1PH
len=len+1
if (len > 3) then
len=3
endif
Chand1PH=close
elsif (close < Chand1PB and Trend=0) then
Chand3PB=Chand2PB
Chand3PH=Chand2PH
Chand2PB=Chand1PB
Chand2PH=Chand1PH
Chand1PH=Chand2PB
len=len+1
if (len > 3) then
len=3
endif
Chand1PB=close
elsif (Trend=1 and ((close < Chand3PB and len=3) or (close < Chand2PB and len=2) or (close < Chand1PB and len=1))) then
Chand3PB=Chand2PB
Chand3PH=Chand2PH
Chand2PB=Chand1PB
Chand2PH=Chand1PH
Chand1PB=close
Chand1PH=Chand2PB
len=1
Trend=0
if (ScreenerBehavior = 0 or ScreenerBehavior = 2) then
Breakout = 1
endif
elsif (Trend=0 and ((close > Chand3PH and len=3) or (close > Chand2PH and len=2) or (close > Chand1PH and len=1))) then
Chand3PB=Chand2PB
Chand3PH=Chand2PH
Chand2PB=Chand1PB
Chand2PH=Chand1PH
Chand1PH=close
Chand1PB=Chand2PH
len=1
Trend=1
if (ScreenerBehavior = 1 or ScreenerBehavior = 2) then
Breakout = 1
endif
endif
screener[Breakout]
You must be logged in to post a comment.
https://www.prorealcode.com/topic/three-line-breakouts/#post-155918
Here is the updated screener with variables that are more understandable:
Hello, The variables ChandXXXX are for the lines in the 3 Lines Break indicator. PB is for the low and PH is for the high of each line. It is not related to ABC patterns but to 3 Lines Break chart visualization you can lean more about it here : https://school.stockcharts.com/doku.php?id=chart_analysis:three_line_break
Buenos Dias, He estado ojeando el código de programación, y no entiendo las variables que usas. En concreto estas: if (close > Chand1PH and Trend=1) then Chand3PB=Chand2PB Chand3PH=Chand2PH Chand2PB=Chand1PB Chand2PH=Chand1PH Chand1PB=Chand1PH len=len+1 if (len > 3) then len=3 endif Chand1PH=close el screener tiene como objetivo localizar pautas planas del tipo ABC? Gracias por el aporte.
Hi What should be added in the code in order to limit the price range of the shares it displays? For example I want it to display only stocks in the range between 10 and 300 dollars. Thank you