Repaints B4 Balanced BB Breakout For ThinkOrSwim

Repaints
Status
Not open for further replies.
This indicator works great but is there a way to setup a scanner when all 3 strategies have a buy signal, for example Up Arrow present on the BalanceofPower Strategy, Up Arrow present on the FibSuperTrend and finally Up Arrow present on the RSI_IFT strategy. I have back tested and noticed that when all 3 strategies have an Up Arrow present it is generally a strong signal to go long and I would like to see if there is a way to scan for these. Again using the 5 min chart for daily scalps.
I made a small update to the script that only shows the buy/sell arrow if every strategy throws a buy/sell signal, looks pretty valuable on 5min+ time frames, so making a scanner shouldn't be too difficult. I may update the earlier multi strategy indicator I posted earlier to include this and post a multi scanner as well, but it sounds like it's something the creators/maintainers are working on so it may not be necessary.
 
I made a small update to the script that only shows the buy/sell arrow if every strategy throws a buy/sell signal, looks pretty valuable on 5min+ time frames, so making a scanner shouldn't be too difficult. I may update the earlier multi strategy indicator I posted earlier to include this and post a multi scanner as well, but it sounds like it's something the creators/maintainers are working on so it may not be necessary.
Post it if you dont mind, I am playing with mtf labels and it might save me some work and head scratching as I frankenstine the piece I am working on. Before I send it over to the mystro to clean up my spill on isle 6 lol.
 
Ruby:
This scanner is for the vertical lines based on FibonacciSuperTrend
    
    ### Market Forecast

def pIntermediate = MarketForecast().Intermediate;

def MF_SIGNAL = if pIntermediate >= 80 or  pIntermediate > pIntermediate[1] then 1 else
    if pIntermediate <= 20 or pIntermediate < pIntermediate[1] then 0 else -1;

### 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_Midline = reference BollingerBands(price = MACDBB_Data, length = MACDBB_BandLength,
                                               Num_Dev_Dn = -MACDBB_NumDev, Num_Dev_Up = MACDBB_NumDev).MidLine;
def MACDBB_Line = MACDBB_Data;
def MACDBB_SIGNAL =
    if MACDBB_Line > MACDBB_Line[1] and MACDBB_Line >= MACDBB_Upper or MACDBB_Line < MACDBB_Line[1] and MACDBB_Line >= MACDBB_Upper then 1
    else if MACDBB_Line < MACDBB_Line[1] and MACDBB_Line <= MACDBB_Lower or MACDBB_Line > MACDBB_Line[1] and MACDBB_Line <= MACDBB_Lower then 0
    else -1;

input MACDBB_CrossFromAboveAlert = {default "Zero", "Lower", "Middle", "Upper"};
input MACDBB_CrossFromBelowAlert = {default "Zero", "Lower", "Middle", "Upper"};

def MACDBB_CrossFromAboveVal = if MACDBB_CrossFromAboveAlert == MACDBB_CrossFromAboveAlert.Lower then MACDBB_Lower
                               else if MACDBB_CrossFromAboveAlert == MACDBB_CrossFromAboveAlert.Upper then MACDBB_Upper
                              else 0;
def MACDBB_CrossFromBelowVal = if MACDBB_CrossFromBelowAlert == MACDBB_CrossFromBelowAlert.Lower then MACDBB_Lower
                               else if MACDBB_CrossFromBelowAlert == MACDBB_CrossFromBelowAlert.Upper then MACDBB_Upper
                               else 0;

def MACDBB_Buy = MACDBB_Data > MACDBB_Upper;
def MACDBB_Sell = MACDBB_Data <= MACDBB_Lower;

def MACDBB_OVERALL_SIGNAL = MACDBB_SIGNAL and MACDBB_Buy;

### RSI/STOCASTIC/MACD CONFLUENCE COMBO

def RSM_MACD_Diff = reference MACD("fast length" = 12, "slow length" = 26, "macd length" = 9).Diff;

def RSM_MACD_Diff_SIGNAL = if RSM_MACD_Diff >= 0 then
        if RSM_MACD_Diff > RSM_MACD_Diff[1] then 1 else -1
    else
        if RSM_MACD_Diff < RSM_MACD_Diff[1] then 0 else -1;

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;

### Divergance
input HMA_Length = 55;
input HMA_Lookback = 2;

def HMA = HullMovingAvg(price = HL2, length = HMA_Length);
def HMA_delta = HMA[1] - HMA[HMA_Lookback + 1];
def HMA_delta_per_bar = HMA_delta / HMA_Lookback;
def HMA_next_bar = HMA[1] + HMA_delta_per_bar;
def HMA_concavity = if HMA > HMA_next_bar then 1 else -1;
def HMA_MA_Max = if HMA[-1] < HMA and HMA > HMA[1] then HMA else Double.NaN;
def HMA_MA_Min = if HMA[-1] > HMA and HMA < HMA[1] then HMA else Double.NaN;
def HMA_divergence = HMA - HMA_next_bar;

def HMA_SIGNAL =  if HMA_divergence[1] < HMA_divergence then 0 else if  HMA_divergence[1] < HMA_divergence then 1 else 1;

### 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];

### 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


def BullBear_Buy = if FST_Direction ==1 then FST_Direction == 1 else no;
plot signal1 =  BullBear_Buy and !BullBear_Buy[1];
 
Ruby:
This scanner is for the vertical lines based on FibonacciSuperTrend
   
    ### Market Forecast

def pIntermediate = MarketForecast().Intermediate;

def MF_SIGNAL = if pIntermediate >= 80 or  pIntermediate > pIntermediate[1] then 1 else
    if pIntermediate <= 20 or pIntermediate < pIntermediate[1] then 0 else -1;

### 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_Midline = reference BollingerBands(price = MACDBB_Data, length = MACDBB_BandLength,
                                               Num_Dev_Dn = -MACDBB_NumDev, Num_Dev_Up = MACDBB_NumDev).MidLine;
def MACDBB_Line = MACDBB_Data;
def MACDBB_SIGNAL =
    if MACDBB_Line > MACDBB_Line[1] and MACDBB_Line >= MACDBB_Upper or MACDBB_Line < MACDBB_Line[1] and MACDBB_Line >= MACDBB_Upper then 1
    else if MACDBB_Line < MACDBB_Line[1] and MACDBB_Line <= MACDBB_Lower or MACDBB_Line > MACDBB_Line[1] and MACDBB_Line <= MACDBB_Lower then 0
    else -1;

input MACDBB_CrossFromAboveAlert = {default "Zero", "Lower", "Middle", "Upper"};
input MACDBB_CrossFromBelowAlert = {default "Zero", "Lower", "Middle", "Upper"};

def MACDBB_CrossFromAboveVal = if MACDBB_CrossFromAboveAlert == MACDBB_CrossFromAboveAlert.Lower then MACDBB_Lower
                               else if MACDBB_CrossFromAboveAlert == MACDBB_CrossFromAboveAlert.Upper then MACDBB_Upper
                              else 0;
def MACDBB_CrossFromBelowVal = if MACDBB_CrossFromBelowAlert == MACDBB_CrossFromBelowAlert.Lower then MACDBB_Lower
                               else if MACDBB_CrossFromBelowAlert == MACDBB_CrossFromBelowAlert.Upper then MACDBB_Upper
                               else 0;

def MACDBB_Buy = MACDBB_Data > MACDBB_Upper;
def MACDBB_Sell = MACDBB_Data <= MACDBB_Lower;

def MACDBB_OVERALL_SIGNAL = MACDBB_SIGNAL and MACDBB_Buy;

### RSI/STOCASTIC/MACD CONFLUENCE COMBO

def RSM_MACD_Diff = reference MACD("fast length" = 12, "slow length" = 26, "macd length" = 9).Diff;

def RSM_MACD_Diff_SIGNAL = if RSM_MACD_Diff >= 0 then
        if RSM_MACD_Diff > RSM_MACD_Diff[1] then 1 else -1
    else
        if RSM_MACD_Diff < RSM_MACD_Diff[1] then 0 else -1;

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;

### Divergance
input HMA_Length = 55;
input HMA_Lookback = 2;

def HMA = HullMovingAvg(price = HL2, length = HMA_Length);
def HMA_delta = HMA[1] - HMA[HMA_Lookback + 1];
def HMA_delta_per_bar = HMA_delta / HMA_Lookback;
def HMA_next_bar = HMA[1] + HMA_delta_per_bar;
def HMA_concavity = if HMA > HMA_next_bar then 1 else -1;
def HMA_MA_Max = if HMA[-1] < HMA and HMA > HMA[1] then HMA else Double.NaN;
def HMA_MA_Min = if HMA[-1] > HMA and HMA < HMA[1] then HMA else Double.NaN;
def HMA_divergence = HMA - HMA_next_bar;

def HMA_SIGNAL =  if HMA_divergence[1] < HMA_divergence then 0 else if  HMA_divergence[1] < HMA_divergence then 1 else 1;

### 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];

### 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


def BullBear_Buy = if FST_Direction ==1 then FST_Direction == 1 else no;
plot signal1 =  BullBear_Buy and !BullBear_Buy[1];
Thank you for your contributions to this project. We are slowly making ground.
 
Ruby:
Final Scan which includes everything :)

# Balanced BB Breakout Indicator
# 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 - cleanup
# v2.1 - Barbaros - added RSI IFT, NumberOfShares, BB crossing options
# v2.2 - Barbaros - fixed PnL issues and removed intraDay filter
# v2.3 - Barbaros - changed input and variable names, RSM is re-done
# v2.4 - Barbaros - removed PnL, added strategy signal arrows and alerts,
#                   added Fibonacci SuperTrend, added unified bar color selection
# beta - Chuck    - added divergence and squeeze label, added squeeze alert
#        Barbaros - cleanup, changed divergance to text, show stoch labels all the time
#        Barbaros - added trend squeeze label for BB, added alerts for Stoch Scalper
#        Barbaros - added options to hide clouds and labels
#        Barbaros - changed trend and divergence colors and text to match
#        Barbaros - removed volume and keltner channel studies, unified squeeze
# v1.2 AspaTrader - Adapted new Indicator and added Fib series. TODO: MarketForecast
# v1.3 AspaTrader - Fixed issue with script complex or timeout
# V2.0 AspaTrade - Added signals for vertical Lines + Market Forecast + MACDBB + RSM Buy Signal + HMA Signal (55 MA) + BOP_Direction + Fibonacci Super Trend
### Market Forecast

def pIntermediate = MarketForecast().Intermediate;

def MF_SIGNAL = if pIntermediate >= 80 or  pIntermediate > pIntermediate[1] then 1 else
    if pIntermediate <= 20 or pIntermediate < pIntermediate[1] then 0 else -1;

### 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_Midline = reference BollingerBands(price = MACDBB_Data, length = MACDBB_BandLength,
                                               Num_Dev_Dn = -MACDBB_NumDev, Num_Dev_Up = MACDBB_NumDev).MidLine;
def MACDBB_Line = MACDBB_Data;
def MACDBB_SIGNAL =
    if MACDBB_Line > MACDBB_Line[1] and MACDBB_Line >= MACDBB_Upper or MACDBB_Line < MACDBB_Line[1] and MACDBB_Line >= MACDBB_Upper then 1
    else if MACDBB_Line < MACDBB_Line[1] and MACDBB_Line <= MACDBB_Lower or MACDBB_Line > MACDBB_Line[1] and MACDBB_Line <= MACDBB_Lower then 0
    else -1;

input MACDBB_CrossFromAboveAlert = {default "Zero", "Lower", "Middle", "Upper"};
input MACDBB_CrossFromBelowAlert = {default "Zero", "Lower", "Middle", "Upper"};

def MACDBB_CrossFromAboveVal = if MACDBB_CrossFromAboveAlert == MACDBB_CrossFromAboveAlert.Lower then MACDBB_Lower
                               else if MACDBB_CrossFromAboveAlert == MACDBB_CrossFromAboveAlert.Upper then MACDBB_Upper
                              else 0;
def MACDBB_CrossFromBelowVal = if MACDBB_CrossFromBelowAlert == MACDBB_CrossFromBelowAlert.Lower then MACDBB_Lower
                               else if MACDBB_CrossFromBelowAlert == MACDBB_CrossFromBelowAlert.Upper then MACDBB_Upper
                               else 0;

def MACDBB_Buy = MACDBB_Data > MACDBB_Upper;
def MACDBB_Sell = MACDBB_Data <= MACDBB_Lower;

def MACDBB_OVERALL_SIGNAL = MACDBB_SIGNAL and MACDBB_Buy;

### RSI/STOCASTIC/MACD CONFLUENCE COMBO

def RSM_MACD_Diff = reference MACD("fast length" = 12, "slow length" = 26, "macd length" = 9).Diff;

def RSM_MACD_Diff_SIGNAL = if RSM_MACD_Diff >= 0 then
        if RSM_MACD_Diff > RSM_MACD_Diff[1] then 1 else -1
    else
        if RSM_MACD_Diff < RSM_MACD_Diff[1] then 0 else -1;

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;

### Divergance
input HMA_Length = 55;
input HMA_Lookback = 2;

def HMA = HullMovingAvg(price = HL2, length = HMA_Length);
def HMA_delta = HMA[1] - HMA[HMA_Lookback + 1];
def HMA_delta_per_bar = HMA_delta / HMA_Lookback;
def HMA_next_bar = HMA[1] + HMA_delta_per_bar;
def HMA_concavity = if HMA > HMA_next_bar then 1 else -1;
def HMA_MA_Max = if HMA[-1] < HMA and HMA > HMA[1] then HMA else Double.NaN;
def HMA_MA_Min = if HMA[-1] > HMA and HMA < HMA[1] then HMA else Double.NaN;
def HMA_divergence = HMA - HMA_next_bar;

def HMA_SIGNAL =  if HMA_divergence[1] < HMA_divergence then 0 else if  HMA_divergence[1] < HMA_divergence then 1 else 1;

### 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];

### 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


def BullBear_Buy = if FST_Direction ==1 then FST_Direction == 1 else no;
plot signal1 = MF_SIGNAL and MACDBB_OVERALL_SIGNAL and RSM_Buy and HMA_SIGNAL and BOP_Direction and BullBear_Buy and !BullBear_Buy[1];
 
Last edited:
@Chuck Please add the above one to the main page :) No further updates until it is properly tested ...

ANET was added to 15Min scan ;)


Thanks will do I am checking it now, could you give a description of everything it scans for, so I can post it . I am not a coder and it takes me a little while to sort through everting. It may be obvious to others but I am a little slow LOL
 
Thanks will do I am checking it now, could you give a description of everything it scans for, so I can post it . I am not a coder and it takes me a little while to sort through everting. It may be obvious to others but I am a little slow LOL
I have added it in the header :)

# V2.0 AspaTrade - Added signals for vertical Lines + All other parameters

Market Forecast + MACDBB + RSM Buy Signal + HMA Signal (55 MA) + BOP_Direction + Fibonacci Super Trend
 
hey guys - this indicator has been amazing! so mega thanks to @Chuck @barbaros and many others that has contributed to this! I had just updated it to v2.5 - and from what i can tell from the change logs the previous features removed were just P/L and added stoch to v2.5, what hit me today after pitting it against the old version v2.3, it seems to lag behind 2.3, but 2.5 is more "safe/accurate/confirmation" if that's the proper way of describing it. Please see the image attached - just wanted to ask, during the changes of v2.4 and v2.5, is that to be expected?
 
hey guys - this indicator has been amazing! so mega thanks to @Chuck @barbaros and many others that has contributed to this! I had just updated it to v2.5 - and from what i can tell from the change logs the previous features removed were just P/L and added stoch to v2.5, what hit me today after pitting it against the old version v2.3, it seems to lag behind 2.3, but 2.5 is more "safe/accurate/confirmation" if that's the proper way of describing it. Please see the image attached - just wanted to ask, during the changes of v2.4 and v2.5, is that to be expected? (sorry unable to post images right now)
The default options have changed from very older revisions of the study. However, there has been a ton of bug fixes and optimizations. It is expected to behave differently.

On the topic of PnL. We removed it because it was very misleading. It was coded to keep buying and selling at the vertical lines only. Also, then you had the extended trading hours turned on, it would trade those as well. So, PnL only showed the vertical line performance and nothing else. The intended purpose of this study is to show you entry and exit (we are still working on the exit strategy) points with the indicators combined in it. The latest versions add entry arrows. Once the exit strategy has been finalized, we'll add the PnL back and we'll all see how it is performing :) It's been performing great for me.
 
I have added it in the header :)

# V2.0 AspaTrade - Added signals for vertical Lines + All other parameters

Market Forecast + MACDBB + RSM Buy Signal + HMA Signal (55 MA) + BOP_Direction + Fibonacci Super Trend
Please forgive any misunderstanding on my part.......Just for clarification, does this scan only search the fib strat
The default options have changed from very older revisions of the study. However, there has been a ton of bug fixes and optimizations. It is expected to behave differently.

On the topic of PnL. We removed it because it was very misleading. It was coded to keep buying and selling at the vertical lines only. Also, then you had the extended trading hours turned on, it would trade those as well. So, PnL only showed the vertical line performance and nothing else. The intended purpose of this study is to show you entry and exit (we are still working on the exit strategy) points with the indicators combined in it. The latest versions add entry arrows. Once the exit strategy has been finalized, we'll add the PnL back and we'll all see how it is performing :) It's been performing great for me.
Nice call, I know others as well as myself liked to use that PnL. Even if we just liked seeing those dollar signs....LOL
 
hey guys - this indicator has been amazing! so mega thanks to @Chuck @barbaros and many others that has contributed to this! I had just updated it to v2.5 - and from what i can tell from the change logs the previous features removed were just P/L and added stoch to v2.5, what hit me today after pitting it against the old version v2.3, it seems to lag behind 2.3, but 2.5 is more "safe/accurate/confirmation" if that's the proper way of describing it. Please see the image attached - just wanted to ask, during the changes of v2.4 and v2.5, is that to be expected?
Ah, now that I can see your chart, I can explain further.

Those arrows from the older versions only showed for MACD histogram crossing zero line. Again, another misleading information, just like the PnL. Latest version has all of that cleared up. As you can see on your chart, the accuracy is pretty good.
 
The default options have changed from very older revisions of the study. However, there has been a ton of bug fixes and optimizations. It is expected to behave differently.

On the topic of PnL. We removed it because it was very misleading. It was coded to keep buying and selling at the vertical lines only. Also, then you had the extended trading hours turned on, it would trade those as well. So, PnL only showed the vertical line performance and nothing else. The intended purpose of this study is to show you entry and exit (we are still working on the exit strategy) points with the indicators combined in it. The latest versions add entry arrows. Once the exit strategy has been finalized, we'll add the PnL back and we'll all see how it is performing :) It's been performing great for me.
thanks so much for your prompt response! - I don't really care about the P/L feature - but just seeing that in 2.5 was at times a few bars behind 2.3 was quite an eye changer, but like i said, 2.5 seems to be more safe/confirmed price action, and v2.3 seems to "jump the gun" the moment price action picks up. i always felt i was ahead of the curve when using 2.3 the past 1.5wks, as i trade based on the indicator direction when the arrows come up, and if i wanted to be "safe" id wait for my charts movingavgcross for confirmation. I will ride 2.5 for a wk and see. but either way, no matter the version, this indicator is BEAST! and ya'll are MONSTERS for the amt of work/fine tuning.
 
Ah, now that I can see your chart, I can explain further.

Those arrows from the older versions only showed for MACD histogram crossing zero line. Again, another misleading information, just like the PnL. Latest version has all of that cleared up. As you can see on your chart, the accuracy is pretty good.
ahhh ok, that would make sense.
 
You will have an edge on momentum and direction with this study...However, I want to caution all new traders. There is no "holly grain", but we are getting pretty close to a gluten free solution....ok, ok, this is the last one, I promise.
Its quite good and Gluten Free..
 
Ruby:
Final Scan which includes everything :)

# Balanced BB Breakout Indicator
# 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 - cleanup
# v2.1 - Barbaros - added RSI IFT, NumberOfShares, BB crossing options
# v2.2 - Barbaros - fixed PnL issues and removed intraDay filter
# v2.3 - Barbaros - changed input and variable names, RSM is re-done
# v2.4 - Barbaros - removed PnL, added strategy signal arrows and alerts,
#                   added Fibonacci SuperTrend, added unified bar color selection
# beta - Chuck    - added divergence and squeeze label, added squeeze alert
#        Barbaros - cleanup, changed divergance to text, show stoch labels all the time
#        Barbaros - added trend squeeze label for BB, added alerts for Stoch Scalper
#        Barbaros - added options to hide clouds and labels
#        Barbaros - changed trend and divergence colors and text to match
#        Barbaros - removed volume and keltner channel studies, unified squeeze
# v1.2 AspaTrader - Adapted new Indicator and added Fib series. TODO: MarketForecast
# v1.3 AspaTrader - Fixed issue with script complex or timeout
# V2.0 AspaTrade - Added signals for vertical Lines + Market Forecast + MACDBB + RSM Buy Signal + HMA Signal (55 MA) + BOP_Direction + Fibonacci Super Trend
### Market Forecast

def pIntermediate = MarketForecast().Intermediate;

def MF_SIGNAL = if pIntermediate >= 80 or  pIntermediate > pIntermediate[1] then 1 else
    if pIntermediate <= 20 or pIntermediate < pIntermediate[1] then 0 else -1;

### 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_Midline = reference BollingerBands(price = MACDBB_Data, length = MACDBB_BandLength,
                                               Num_Dev_Dn = -MACDBB_NumDev, Num_Dev_Up = MACDBB_NumDev).MidLine;
def MACDBB_Line = MACDBB_Data;
def MACDBB_SIGNAL =
    if MACDBB_Line > MACDBB_Line[1] and MACDBB_Line >= MACDBB_Upper or MACDBB_Line < MACDBB_Line[1] and MACDBB_Line >= MACDBB_Upper then 1
    else if MACDBB_Line < MACDBB_Line[1] and MACDBB_Line <= MACDBB_Lower or MACDBB_Line > MACDBB_Line[1] and MACDBB_Line <= MACDBB_Lower then 0
    else -1;

input MACDBB_CrossFromAboveAlert = {default "Zero", "Lower", "Middle", "Upper"};
input MACDBB_CrossFromBelowAlert = {default "Zero", "Lower", "Middle", "Upper"};

def MACDBB_CrossFromAboveVal = if MACDBB_CrossFromAboveAlert == MACDBB_CrossFromAboveAlert.Lower then MACDBB_Lower
                               else if MACDBB_CrossFromAboveAlert == MACDBB_CrossFromAboveAlert.Upper then MACDBB_Upper
                              else 0;
def MACDBB_CrossFromBelowVal = if MACDBB_CrossFromBelowAlert == MACDBB_CrossFromBelowAlert.Lower then MACDBB_Lower
                               else if MACDBB_CrossFromBelowAlert == MACDBB_CrossFromBelowAlert.Upper then MACDBB_Upper
                               else 0;

def MACDBB_Buy = MACDBB_Data > MACDBB_Upper;
def MACDBB_Sell = MACDBB_Data <= MACDBB_Lower;

def MACDBB_OVERALL_SIGNAL = MACDBB_SIGNAL and MACDBB_Buy;

### RSI/STOCASTIC/MACD CONFLUENCE COMBO

def RSM_MACD_Diff = reference MACD("fast length" = 12, "slow length" = 26, "macd length" = 9).Diff;

def RSM_MACD_Diff_SIGNAL = if RSM_MACD_Diff >= 0 then
        if RSM_MACD_Diff > RSM_MACD_Diff[1] then 1 else -1
    else
        if RSM_MACD_Diff < RSM_MACD_Diff[1] then 0 else -1;

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;

### Divergance
input HMA_Length = 55;
input HMA_Lookback = 2;

def HMA = HullMovingAvg(price = HL2, length = HMA_Length);
def HMA_delta = HMA[1] - HMA[HMA_Lookback + 1];
def HMA_delta_per_bar = HMA_delta / HMA_Lookback;
def HMA_next_bar = HMA[1] + HMA_delta_per_bar;
def HMA_concavity = if HMA > HMA_next_bar then 1 else -1;
def HMA_MA_Max = if HMA[-1] < HMA and HMA > HMA[1] then HMA else Double.NaN;
def HMA_MA_Min = if HMA[-1] > HMA and HMA < HMA[1] then HMA else Double.NaN;
def HMA_divergence = HMA - HMA_next_bar;

def HMA_SIGNAL =  if HMA_divergence[1] < HMA_divergence then 0 else if  HMA_divergence[1] < HMA_divergence then 1 else 1;

### 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];

### 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


def BullBear_Buy = if FST_Direction ==1 then FST_Direction == 1 else no;
plot signal1 = MF_SIGNAL and MACDBB_OVERALL_SIGNAL and RSM_Buy and HMA_SIGNAL and BOP_Direction and BullBear_Buy and !BullBear_Buy[1];
@AspaTrader, take a look at post #286 and reach out if you don't mind?
 
Status
Not open for further replies.

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
224 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top