Hi, I tried to code a screener for Walter Peters (The naked trader) BBC setup. This is what I coded so far.
It would be nice to get any help or guidence to make this code more efficient/shorter/better and load it up to the library.
Thank you ……….
// Bullish Big (engulfing) candle
C1 = High>High[1] AND High>High[2] AND High>High[3] AND High>High[4] AND High>High[5] AND High>High[6]
AND High>High[7] AND High>High[8] AND High>High[9] AND High>High[10] AND Low<Low[1] AND Low<Low[2] AND Low<Low[3] AND Low<Low[4] AND Low<Low[5]
AND Low<Low[6] AND Low<Low[7] AND Low<Low[8] AND Low<Low[9] AND Low<Low[10] AND Close[1] < Open[1] AND Open < Close[1] AND Close > Open[1] AND Open < Close
// Bearish Big (engulfing) candle
C2 = High>High[1] AND High>High[2] AND High>High[3] AND High>High[4] AND High>High[5] AND High>High[6]
AND High>High[7] AND High>High[8] AND High>High[9] AND High>High[10] AND Low<Low[1] AND Low<Low[2] AND Low<Low[3] AND Low<Low[4] AND Low<Low[5]
AND Low<Low[6] AND Low<Low[7] AND Low<Low[8] AND Low<Low[9] AND Low<Low[10] AND Close[1] > Open[1] AND Close < Open AND Open > Close[1] AND Close < Open[1]
Screener[(C1) OR (C2)]
Does it works already? Is it accurate? We could make it shorter by summarize the boolean results of all the High>High[x] (and Low<Low[x]) comparisons.
@Nicolas, Yes it works accurate. The problem is that Peters advice is to look back beween 6 and 10 candles. I tested the screener with 6 candles and it performed well. Summarize the boolean results is a thing I don’t know how to do. (this is the reason for this post)
Here is the screener for you:
(Only managed to find matching conditions on the Weekly)
Dir = 0
If (High > Highest[10](High)[1]) and (Low < Lowest[10](low)[1]) Then
If close[1] < open[1] and open < close[1] and close > open[1] and close > open Then
Dir = 1
ElsIf close[1] > open[1] and open > close[1] and close < open[1] and close < open Then
Dir = -1
EndIf
EndIf
Condition = (Dir <> 0)
SCREENER[Condition] (Dir AS "Direction")
@Juanj, Great. This weekend i will try to make it work on the daily timeframe or combine it with the screener I have so far.
Thank you………