Everyone, here is a proposal for the scanner. Please note that ToS cannot run complex scripts. Due to this, I had to remove Market Forecast, Concavity and Squeeze. I wish we could have all those in as options, but ToS errors out that script is too complex.
Most options are kept. It works exactly like the chart arrows. If you want buy signal, you set the value to 1. If you want sell signal, you set the value to -1.
Most options are kept. It works exactly like the chart arrows. If you want buy signal, you set the value to 1. If you want sell signal, you set the value to -1.
Code:
# Balanced BB Breakout Scanner
#
# Free for use. Header credits must be included when any form of the code included in this package is used.
# User assumes all risk. Author not responsible for errors or use of tool.
#
# v1.2 - Assembled by Chuck Edwards
# v2.0 - Barbaros - Scanner Update, removed Market Forecast, HULL Concavity and Squeeze due to ToS limitation
### MACDBB
input MACDBB_FastLength = 12;
input MACDBB_SlowLength = 26;
input MACDBB_Length = 25;
input MACDBB_BandLength = 15;
input MACDBB_NumDev = 1.0;
def MACDBB_Data = MACD(fastLength = MACDBB_FastLength, slowLength = MACDBB_SlowLength, MACDLength = MACDBB_Length);
def MACDBB_Upper = reference BollingerBands(price = MACDBB_Data, length = MACDBB_BandLength,
Num_Dev_Dn = -MACDBB_NumDev, Num_Dev_Up = MACDBB_NumDev).UpperBand;;
def MACDBB_Lower = reference BollingerBands(price = MACDBB_Data, length = MACDBB_BandLength,
Num_Dev_Dn = -MACDBB_NumDev, Num_Dev_Up = MACDBB_NumDev).Lowerband;
def MACDBB_Buy = MACDBB_Data > MACDBB_Upper;
def MACDBB_Sell = MACDBB_Data <= MACDBB_Lower;
### RSI/STOCASTIC/MACD CONFLUENCE COMBO
def RSM_MACD_Diff = reference MACD(fastLength = 12, slowLength = 26, MACDLength = 9).Diff;
def RSM_MACD_ZeroLine = 0;
def RSM_RSI = reference RSI(length = 7).RSI;
def RSM_Stoch_Val = 100 * (close - lowest(low, 14)) / (highest(high, 14) - lowest(low, 14));
def RSM_StochSlowK = SimpleMovingAvg(SimpleMovingAvg(RSM_Stoch_Val,3),3);
def RSM_rsiGreen = RSM_RSI >= 50;
def RSM_rsiRed = RSM_RSI < 50;
def RSM_stochGreen = RSM_StochSlowK >= 50;
def RSM_stochRed = RSM_StochSlowK < 50;
def RSM_macdGreen = RSM_MACD_Diff >= 0;
def RSM_macdRed = RSM_MACD_Diff < 0;
def RSM_Buy = RSM_rsiGreen and RSM_stochGreen and RSM_macdGreen;
def RSM_Sell = RSM_rsiRed and RSM_stochRed and RSM_macdRed;
### Balance of Power
input BOP_EMA_Length = 20;
input BOP_TEMA_Length = 20;
def BOP_THL = If(high != low, high - low, 0.01);
def BOP_BullOpen = (high - open) / BOP_THL;
def BOP_BearOpen = (open - low) / BOP_THL;
def BOP_BullClose = (close - low) / BOP_THL;
def BOP_BearClose = (high - close) / BOP_THL;
def BOP_BullOC = If(close > open, (close - open) / BOP_THL, 0);
def BOP_BearOC = If(open > close, (open - close) / BOP_THL, 0);
def BOP_BullReward = (BOP_BullOpen + BOP_BullClose + BOP_BullOC) / 1;
def BOP_BearReward = (BOP_BearOpen + BOP_BearClose + BOP_BearOC) / 1;
def BOP_BOP = BOP_BullReward - BOP_BearReward;
def BOP_SmoothBOP = ExpAverage(BOP_BOP, BOP_EMA_Length);
def BOP_xPrice = BOP_SmoothBOP;
def BOP_xEMA1 = ExpAverage(BOP_SmoothBOP, BOP_TEMA_Length);
def BOP_xEMA2 = ExpAverage(BOP_xEMA1, BOP_TEMA_Length);
def BOP_xEMA3 = ExpAverage(BOP_xEMA2, BOP_TEMA_Length);
def BOP_nRes = 3 * BOP_xEMA1 - 3 * BOP_xEMA2 + BOP_xEMA3;
def BOP_SmootherBOP = BOP_nRes;
def BOP_s1 = BOP_SmoothBOP;
def BOP_s2 = BOP_SmootherBOP;
def BOP_s3 = BOP_SmootherBOP[2];
def BOP_Direction = if BarNumber() == 1 then 0
else if BOP_s2 < BOP_s3 and BOP_s2[1] > BOP_s3[1] then -1
else if BOP_s2 > BOP_s3 and BOP_s2[1] < BOP_s3[1] then 1
else BOP_Direction[1];
### RSI IFT
def RSI_IFT_R = reference RSI(5, close) - 50;
def RSI_IFT_AvgRSI = MovingAverage(AverageType.Exponential,RSI_IFT_R,9);
def RSI_IFT_InverseRSI = (Power(Double.E, 2 * RSI_IFT_AvgRSI) - 1) / (Power(Double.E, 2 * RSI_IFT_AvgRSI) + 1);
def RSI_IFT_Direction = if BarNumber() == 0 then 0
else if (RSI_IFT_InverseRSI[1] > 0) and (RSI_IFT_InverseRSI < 0) then -1
else if (RSI_IFT_InverseRSI > 0) and (RSI_IFT_InverseRSI[1] < 0) then 1
else RSI_IFT_Direction[1];
### Fibonacci SuperTrend
input FST_Length = 11;
input FST_Retrace = 23.6;
input FST_UseHighLow = yes;
def FST_h = if FST_UseHighLow then high else close;
def FST_l = if FST_UseHighLow then low else close;
def FST_minL = Lowest(FST_l, FST_Length);
def FST_maxH = Highest(FST_h, FST_Length);
def FST_hh = if FST_h > FST_maxH[1] then FST_h else FST_hh[1];
def FST_ll = if FST_l < FST_minL[1] then FST_l else FST_ll[1];
def FST_trend = if FST_h > FST_maxH[1] then 1 else if FST_l < FST_minL[1] then -1 else FST_trend[1];
def FST_Direction = if BarNumber() == 0 then 0
else if FST_trend != 1 then -1
else if FST_trend == 1 then 1
else FST_Direction[1];
### Strategy
input BullBear = { "BalanceOfPower", "FibonacciSuperTrend", default "RSI_IFT" };
def BullBear_Buy = if BullBear == BullBear.BalanceOfPower then BOP_Direction == 1
else if BullBear == BullBear.FibonacciSuperTrend then FST_Direction == 1
else if BullBear == BullBear.RSI_IFT then RSI_IFT_Direction == 1
else no;
def BullBear_Sell = if BullBear == BullBear.BalanceOfPower then BOP_Direction == -1
else if BullBear == BullBear.FibonacciSuperTrend then FST_Direction == -1
else if BullBear == BullBear.RSI_IFT then RSI_IFT_Direction == -1
else no;
def Strategy_Buy = BullBear_Buy and MACDBB_Buy and RSM_Buy;
def Strategy_Sell = BullBear_Sell and MACDBB_Sell and RSM_Sell;
plot StrategyArrow = if Strategy_Buy and !Strategy_Buy[1] then 1
else if Strategy_Sell and !Strategy_Sell[1] then -1
else 0;