Caught BA this morning before it popped. Along with some other confirmations but this definitely helped me execute.
BA chart
# 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.0 - AspaTrader - added Scan code for bullish on top of the script .. thanks to Chuck and barbaros for their scripts
# Market Forecast
def pIntermediate = MarketForecast().Intermediate;
def signal_Forecasat = if (pIntermediate > pIntermediate[1] or pIntermediate >= 80) then 1 else 0;
# MACD_BB
input BBlength = 15;
input BBNum_Dev = 1.0;
input MACDfastLength = 12;
input MACDslowLength = 26;
input fastLengthMACD = 12;
input slowLengthMACD = 26;
input MACDLength = 25;
input averageTypeMACD = AverageType.WEIGHTED;
input showBreakoutSignals = no;
def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength);
def BB_Upper = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;
def BB_Lower = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;
def BB_Midline = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;
def signal_MACD = if MACD_Data > MACD_Data[1] and MACD_Data >= BB_Upper or MACD_Data < MACD_Data[1] and MACD_Data >= BB_Upper then 1 else 0;
# Keltner Channels
input factor = 1.5;
input length = 20;
input averageType = AverageType.EXPONENTIAL;
input trueRangeAverageType = AverageType.EXPONENTIAL;
def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def average = MovingAverage(averageType, close, length);
def Upper_Band = average + shift;
def Lower_Band = average - shift;
# Bollinger Bands
input BBLength2 = 20;
input Num_Dev_Dn = -2.0;
input Num_Dev_up = 2.0;
input bb_averageType = AverageType.SIMPLE;
def sDev = StDev(data = close, length = BBLength2);
def MidLine = MovingAverage(bb_averageType, data = close, length = BBLength2);
def LowerBand = MidLine + Num_Dev_Dn * sDev;
def UpperBand = MidLine + Num_Dev_up * sDev;
# BB Alert
input BBCrossFromAboveAlert = {default "Zero", "Lower", "Middle", "Upper"};
input BBCrossFromBelowAlert = {default "Zero", "Lower", "Middle", "Upper"};
def BBCrossFromAboveVal = if BBCrossFromAboveAlert == BBCrossFromAboveAlert.Lower then BB_Lower
else if BBCrossFromAboveAlert == BBCrossFromAboveAlert.Upper then BB_Upper
else 0;
def BBCrossFromBelowVal = if BBCrossFromBelowAlert == BBCrossFromBelowAlert.Lower then BB_Lower
else if BBCrossFromBelowAlert == BBCrossFromBelowAlert.Upper then BB_Upper
else 0;
def signal_BB = if MACD_Data crosses above BBCrossFromBelowVal then 1 else 0;
# RSI/STOCASTIC/MACD CONFLUENCE COMBO
def Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD);
def Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
def Diff = Value - Avg;
def signal_RSI = if Diff >= 0 and Diff > Diff[1] then 1 else 0;
def ZeroLine = 0;
def UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
input lengthRSI = 7;
input averageTypeRSI = AverageType.EXPONENTIAL;
def NetChgAvg = MovingAverage(averageTypeRSI, close - close[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(close - close[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
input KPeriod = 5;
input DPeriod = 3;
input averageTypeStoch = AverageType.WILDERS;
def SlowK = reference StochasticFull(80, 20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(80, 20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullD;
def rsiGreen = if RSI >= 50 then 1 else Double.NaN;
def rsiRed = if RSI < 50 then 1 else Double.NaN;
def stochGreen = if SlowK >= 50 then 1 else Double.NaN;
def stochRed = if SlowK < 50 then 1 else Double.NaN;
def macdGreen = if Value > Avg then 1 else Double.NaN;
def macdRed = if Value < Avg then 1 else Double.NaN;
def signal_Stoch = if RSI >= 50 and SlowK >= 50 and Value > Avg then 1 else if RSI < 50 and SlowK < 50 and Value < Avg then 0 else 0;
# Balance of Power
input EMA = 20;
input TEMA = 20;
def THL = If(high != low, high - low, 0.01);
def BullOpen = (high - open) / THL;
def BearOpen = (open - low) / THL;
def BullClose = (close - low) / THL;
def BearClose = (high - close) / THL;
def BullOC = If(close > open, (close - open) / THL, 0);
def BearOC = If(open > close, (open - close) / THL, 0);
def BullReward = (BullOpen + BullClose + BullOC) / 1;
def BearReward = (BearOpen + BearClose + BearOC) / 1;
def BOP = BullReward - BearReward;
def SmoothBOP = ExpAverage(BOP, EMA);
def xPrice = SmoothBOP;
def xEMA1 = ExpAverage(SmoothBOP, TEMA);
def xEMA2 = ExpAverage(xEMA1, TEMA);
def xEMA3 = ExpAverage(xEMA2, TEMA);
def nRes = 3 * xEMA1 - 3 * xEMA2 + xEMA3;
def SmootherBOP = nRes;
def s1 = SmoothBOP;
def s2 = SmootherBOP;
def s3 = SmootherBOP[2];
def BOPshort = s2 < s3 and s2[1] > s3[1];
def BOPlong = s2 > s3 and s2[1] < s3[1];
# RSI IFT
def over_Bought = .5;
def over_Sold = -.5;
def R = reference RSI(5, close) - 50;
def AvgRSI = MovingAverage(AverageType.Exponential,R,9);
def inverseRSI = (Power(Double.E, 2 * AvgRSI) - 1) / (Power(Double.E, 2 * AvgRSI) + 1);
def RSI_IFT_Buy = (inverseRSI > 0) and (inverseRSI[1] < 0);
def RSI_IFT_Sell = (inverseRSI[1] > 0) and (inverseRSI < 0);
plot signal = if signal_Forecasat and signal_BB and signal_MACD and signal_RSI and signal_Stoch then 1 else 0;
hello friend a question any scan for rsm script?Ha!!!!! I Just nailed a 6pt move with /ES on 5m TF. Could not let you be beating me. Learning a lot about this indicator and it's advantages...that I dont see on others.
Thank you, that is cool . I will try it out today!I created a scan for it , See if this helps, this is only for bullish.
Ruby:# 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 - AspaTrader - added Scan code for bullish # Market Forecast def pIntermediate = MarketForecast().Intermediate; def signal_Forecasat = if (pIntermediate > pIntermediate[1] or pIntermediate >= 80) then 1 else 0; # MACD_BB input BBlength = 15; input BBNum_Dev = 1.0; input MACDfastLength = 12; input MACDslowLength = 26; input fastLengthMACD = 12; input slowLengthMACD = 26; input MACDLength = 25; input averageTypeMACD = AverageType.WEIGHTED; input showBreakoutSignals = no; def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength); def BB_Upper = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand; def BB_Lower = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband; def BB_Midline = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine; def signal_MACD = if MACD_Data > MACD_Data[1] and MACD_Data >= BB_Upper or MACD_Data < MACD_Data[1] and MACD_Data >= BB_Upper then 1 else 0; # Keltner Channels input factor = 1.5; input length = 20; input averageType = AverageType.EXPONENTIAL; input trueRangeAverageType = AverageType.EXPONENTIAL; def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length); def average = MovingAverage(averageType, close, length); def Upper_Band = average + shift; def Lower_Band = average - shift; # Bollinger Bands input BBLength2 = 20; input Num_Dev_Dn = -2.0; input Num_Dev_up = 2.0; input bb_averageType = AverageType.SIMPLE; def sDev = StDev(data = close, length = BBLength2); def MidLine = MovingAverage(bb_averageType, data = close, length = BBLength2); def LowerBand = MidLine + Num_Dev_Dn * sDev; def UpperBand = MidLine + Num_Dev_up * sDev; # BB Alert input BBCrossFromAboveAlert = {default "Zero", "Lower", "Middle", "Upper"}; input BBCrossFromBelowAlert = {default "Zero", "Lower", "Middle", "Upper"}; def BBCrossFromAboveVal = if BBCrossFromAboveAlert == BBCrossFromAboveAlert.Lower then BB_Lower else if BBCrossFromAboveAlert == BBCrossFromAboveAlert.Upper then BB_Upper else 0; def BBCrossFromBelowVal = if BBCrossFromBelowAlert == BBCrossFromBelowAlert.Lower then BB_Lower else if BBCrossFromBelowAlert == BBCrossFromBelowAlert.Upper then BB_Upper else 0; def signal_BB = if MACD_Data crosses above BBCrossFromBelowVal then 1 else 0; # RSI/STOCASTIC/MACD CONFLUENCE COMBO def Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD); def Avg = MovingAverage(averageTypeMACD, Value, MACDLength); def Diff = Value - Avg; def signal_RSI = if Diff >= 0 and Diff > Diff[1] then 1 else 0; def ZeroLine = 0; def UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN; input lengthRSI = 7; input averageTypeRSI = AverageType.EXPONENTIAL; def NetChgAvg = MovingAverage(averageTypeRSI, close - close[1], lengthRSI); def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(close - close[1]), lengthRSI); def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0; def RSI = 50 * (ChgRatio + 1); input KPeriod = 5; input DPeriod = 3; input averageTypeStoch = AverageType.WILDERS; def SlowK = reference StochasticFull(80, 20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullK; def SlowD = reference StochasticFull(80, 20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullD; def rsiGreen = if RSI >= 50 then 1 else Double.NaN; def rsiRed = if RSI < 50 then 1 else Double.NaN; def stochGreen = if SlowK >= 50 then 1 else Double.NaN; def stochRed = if SlowK < 50 then 1 else Double.NaN; def macdGreen = if Value > Avg then 1 else Double.NaN; def macdRed = if Value < Avg then 1 else Double.NaN; def signal_Stoch = if RSI >= 50 and SlowK >= 50 and Value > Avg then 1 else if RSI < 50 and SlowK < 50 and Value < Avg then 0 else 0; # Balance of Power input EMA = 20; input TEMA = 20; def THL = If(high != low, high - low, 0.01); def BullOpen = (high - open) / THL; def BearOpen = (open - low) / THL; def BullClose = (close - low) / THL; def BearClose = (high - close) / THL; def BullOC = If(close > open, (close - open) / THL, 0); def BearOC = If(open > close, (open - close) / THL, 0); def BullReward = (BullOpen + BullClose + BullOC) / 1; def BearReward = (BearOpen + BearClose + BearOC) / 1; def BOP = BullReward - BearReward; def SmoothBOP = ExpAverage(BOP, EMA); def xPrice = SmoothBOP; def xEMA1 = ExpAverage(SmoothBOP, TEMA); def xEMA2 = ExpAverage(xEMA1, TEMA); def xEMA3 = ExpAverage(xEMA2, TEMA); def nRes = 3 * xEMA1 - 3 * xEMA2 + xEMA3; def SmootherBOP = nRes; def s1 = SmoothBOP; def s2 = SmootherBOP; def s3 = SmootherBOP[2]; def BOPshort = s2 < s3 and s2[1] > s3[1]; def BOPlong = s2 > s3 and s2[1] < s3[1]; # RSI IFT def over_Bought = .5; def over_Sold = -.5; def R = reference RSI(5, close) - 50; def AvgRSI = MovingAverage(AverageType.Exponential,R,9); def inverseRSI = (Power(Double.E, 2 * AvgRSI) - 1) / (Power(Double.E, 2 * AvgRSI) + 1); def RSI_IFT_Buy = (inverseRSI > 0) and (inverseRSI[1] < 0); def RSI_IFT_Sell = (inverseRSI[1] > 0) and (inverseRSI < 0); plot signal = if signal_Forecasat and signal_BB and signal_MACD and signal_RSI and signal_Stoch then 1 else 0;
tx body!!Thank you, that is cool . I will try it out today!
Way to go!! Congrats to you guys!! Chuck congrats on it all coming together it looks and works amazing! Thanks so much to you, @cos251 @barbaros @AspaTrader for all collaborating!!Ha!!!!! I Just nailed a 6pt move with /ES on 5m TF. Could not let you be beating me. Learning a lot about this indicator and it's advantages...that I dont see on others.
Awesome thanks for the scan!!I created a scan for it , See if this helps, this is only for bullish.
Ruby:# 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 - AspaTrader - added Scan code for bullish # Market Forecast def pIntermediate = MarketForecast().Intermediate; def signal_Forecasat = if (pIntermediate > pIntermediate[1] or pIntermediate >= 80) then 1 else 0; # MACD_BB input BBlength = 15; input BBNum_Dev = 1.0; input MACDfastLength = 12; input MACDslowLength = 26; input fastLengthMACD = 12; input slowLengthMACD = 26; input MACDLength = 25; input averageTypeMACD = AverageType.WEIGHTED; input showBreakoutSignals = no; def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength); def BB_Upper = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand; def BB_Lower = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband; def BB_Midline = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine; def signal_MACD = if MACD_Data > MACD_Data[1] and MACD_Data >= BB_Upper or MACD_Data < MACD_Data[1] and MACD_Data >= BB_Upper then 1 else 0; # Keltner Channels input factor = 1.5; input length = 20; input averageType = AverageType.EXPONENTIAL; input trueRangeAverageType = AverageType.EXPONENTIAL; def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length); def average = MovingAverage(averageType, close, length); def Upper_Band = average + shift; def Lower_Band = average - shift; # Bollinger Bands input BBLength2 = 20; input Num_Dev_Dn = -2.0; input Num_Dev_up = 2.0; input bb_averageType = AverageType.SIMPLE; def sDev = StDev(data = close, length = BBLength2); def MidLine = MovingAverage(bb_averageType, data = close, length = BBLength2); def LowerBand = MidLine + Num_Dev_Dn * sDev; def UpperBand = MidLine + Num_Dev_up * sDev; # BB Alert input BBCrossFromAboveAlert = {default "Zero", "Lower", "Middle", "Upper"}; input BBCrossFromBelowAlert = {default "Zero", "Lower", "Middle", "Upper"}; def BBCrossFromAboveVal = if BBCrossFromAboveAlert == BBCrossFromAboveAlert.Lower then BB_Lower else if BBCrossFromAboveAlert == BBCrossFromAboveAlert.Upper then BB_Upper else 0; def BBCrossFromBelowVal = if BBCrossFromBelowAlert == BBCrossFromBelowAlert.Lower then BB_Lower else if BBCrossFromBelowAlert == BBCrossFromBelowAlert.Upper then BB_Upper else 0; def signal_BB = if MACD_Data crosses above BBCrossFromBelowVal then 1 else 0; # RSI/STOCASTIC/MACD CONFLUENCE COMBO def Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD); def Avg = MovingAverage(averageTypeMACD, Value, MACDLength); def Diff = Value - Avg; def signal_RSI = if Diff >= 0 and Diff > Diff[1] then 1 else 0; def ZeroLine = 0; def UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN; input lengthRSI = 7; input averageTypeRSI = AverageType.EXPONENTIAL; def NetChgAvg = MovingAverage(averageTypeRSI, close - close[1], lengthRSI); def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(close - close[1]), lengthRSI); def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0; def RSI = 50 * (ChgRatio + 1); input KPeriod = 5; input DPeriod = 3; input averageTypeStoch = AverageType.WILDERS; def SlowK = reference StochasticFull(80, 20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullK; def SlowD = reference StochasticFull(80, 20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullD; def rsiGreen = if RSI >= 50 then 1 else Double.NaN; def rsiRed = if RSI < 50 then 1 else Double.NaN; def stochGreen = if SlowK >= 50 then 1 else Double.NaN; def stochRed = if SlowK < 50 then 1 else Double.NaN; def macdGreen = if Value > Avg then 1 else Double.NaN; def macdRed = if Value < Avg then 1 else Double.NaN; def signal_Stoch = if RSI >= 50 and SlowK >= 50 and Value > Avg then 1 else if RSI < 50 and SlowK < 50 and Value < Avg then 0 else 0; # Balance of Power input EMA = 20; input TEMA = 20; def THL = If(high != low, high - low, 0.01); def BullOpen = (high - open) / THL; def BearOpen = (open - low) / THL; def BullClose = (close - low) / THL; def BearClose = (high - close) / THL; def BullOC = If(close > open, (close - open) / THL, 0); def BearOC = If(open > close, (open - close) / THL, 0); def BullReward = (BullOpen + BullClose + BullOC) / 1; def BearReward = (BearOpen + BearClose + BearOC) / 1; def BOP = BullReward - BearReward; def SmoothBOP = ExpAverage(BOP, EMA); def xPrice = SmoothBOP; def xEMA1 = ExpAverage(SmoothBOP, TEMA); def xEMA2 = ExpAverage(xEMA1, TEMA); def xEMA3 = ExpAverage(xEMA2, TEMA); def nRes = 3 * xEMA1 - 3 * xEMA2 + xEMA3; def SmootherBOP = nRes; def s1 = SmoothBOP; def s2 = SmootherBOP; def s3 = SmootherBOP[2]; def BOPshort = s2 < s3 and s2[1] > s3[1]; def BOPlong = s2 > s3 and s2[1] < s3[1]; # RSI IFT def over_Bought = .5; def over_Sold = -.5; def R = reference RSI(5, close) - 50; def AvgRSI = MovingAverage(AverageType.Exponential,R,9); def inverseRSI = (Power(Double.E, 2 * AvgRSI) - 1) / (Power(Double.E, 2 * AvgRSI) + 1); def RSI_IFT_Buy = (inverseRSI > 0) and (inverseRSI[1] < 0); def RSI_IFT_Sell = (inverseRSI[1] > 0) and (inverseRSI < 0); plot signal = if signal_Forecasat and signal_BB and signal_MACD and signal_RSI and signal_Stoch then 1 else 0;
Congrats!!!!! I decided to take today off. It turned out to be a good day to trade.Ha!!!!! I Just nailed a 6pt move with /ES on 5m TF. Could not let you be beating me. Learning a lot about this indicator and it's advantages...that I dont see on others.
@Chuck Alerts right now are not visualized on the chart and the current arrows are for the MACD crossing, which is separate than the MACD_BB. Do you think we should also add arrows to visualize the alerts too? or would it crowd the chart too much?From what I am seeing, the RSI_IFT fires great for entries, that is entries bullish or bearish. That being said from my experience it has not been the best exit for either bullish positions of bearish positions. Not every trade is going to reverse on the dime. For exits on a bullish position I like to bump up the" bb number dev" up. To do that I look at the present chart and adjust the setting till the top red line crosses exactly where I feel comfortable exiting. Then I set the the indicator to be alerted when the "bb crosses from above aler/Upper" (double check that) with simulation and see if that will generate a better exit. And just the opposite on bearish trades. This is not trading advice and you need to calculate your own risk tolerance levels. But that is how I personally like to do it. This is a brand new work and hopefully it will continue to improve and progress. A lot of talented genourus people have gotten involved with this project and it is making strides everyday. Perhaps just monitor for a while till you can tweak it to your preference. Any feedback and sujestions are always welcomed. Thats how we pull together as a team and grow here on this forum. Our ultimate goal is to share tools in an effort to help one another out.
Thanks for the scan addition. I'll test and incorporate for long and short into it officially. Good job on the addition.I created a scan for it , See if this helps, this is only for bullish.
Ruby:# 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 - AspaTrader - added Scan code for bullish # Market Forecast def pIntermediate = MarketForecast().Intermediate; def signal_Forecasat = if (pIntermediate > pIntermediate[1] or pIntermediate >= 80) then 1 else 0; # MACD_BB input BBlength = 15; input BBNum_Dev = 1.0; input MACDfastLength = 12; input MACDslowLength = 26; input fastLengthMACD = 12; input slowLengthMACD = 26; input MACDLength = 25; input averageTypeMACD = AverageType.WEIGHTED; input showBreakoutSignals = no; def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength); def BB_Upper = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand; def BB_Lower = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband; def BB_Midline = reference BollingerBands(price = MACD_Data, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine; def signal_MACD = if MACD_Data > MACD_Data[1] and MACD_Data >= BB_Upper or MACD_Data < MACD_Data[1] and MACD_Data >= BB_Upper then 1 else 0; # Keltner Channels input factor = 1.5; input length = 20; input averageType = AverageType.EXPONENTIAL; input trueRangeAverageType = AverageType.EXPONENTIAL; def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length); def average = MovingAverage(averageType, close, length); def Upper_Band = average + shift; def Lower_Band = average - shift; # Bollinger Bands input BBLength2 = 20; input Num_Dev_Dn = -2.0; input Num_Dev_up = 2.0; input bb_averageType = AverageType.SIMPLE; def sDev = StDev(data = close, length = BBLength2); def MidLine = MovingAverage(bb_averageType, data = close, length = BBLength2); def LowerBand = MidLine + Num_Dev_Dn * sDev; def UpperBand = MidLine + Num_Dev_up * sDev; # BB Alert input BBCrossFromAboveAlert = {default "Zero", "Lower", "Middle", "Upper"}; input BBCrossFromBelowAlert = {default "Zero", "Lower", "Middle", "Upper"}; def BBCrossFromAboveVal = if BBCrossFromAboveAlert == BBCrossFromAboveAlert.Lower then BB_Lower else if BBCrossFromAboveAlert == BBCrossFromAboveAlert.Upper then BB_Upper else 0; def BBCrossFromBelowVal = if BBCrossFromBelowAlert == BBCrossFromBelowAlert.Lower then BB_Lower else if BBCrossFromBelowAlert == BBCrossFromBelowAlert.Upper then BB_Upper else 0; def signal_BB = if MACD_Data crosses above BBCrossFromBelowVal then 1 else 0; # RSI/STOCASTIC/MACD CONFLUENCE COMBO def Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD); def Avg = MovingAverage(averageTypeMACD, Value, MACDLength); def Diff = Value - Avg; def signal_RSI = if Diff >= 0 and Diff > Diff[1] then 1 else 0; def ZeroLine = 0; def UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN; input lengthRSI = 7; input averageTypeRSI = AverageType.EXPONENTIAL; def NetChgAvg = MovingAverage(averageTypeRSI, close - close[1], lengthRSI); def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(close - close[1]), lengthRSI); def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0; def RSI = 50 * (ChgRatio + 1); input KPeriod = 5; input DPeriod = 3; input averageTypeStoch = AverageType.WILDERS; def SlowK = reference StochasticFull(80, 20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullK; def SlowD = reference StochasticFull(80, 20, KPeriod, DPeriod, high, low, close, 3, averageTypeStoch).FullD; def rsiGreen = if RSI >= 50 then 1 else Double.NaN; def rsiRed = if RSI < 50 then 1 else Double.NaN; def stochGreen = if SlowK >= 50 then 1 else Double.NaN; def stochRed = if SlowK < 50 then 1 else Double.NaN; def macdGreen = if Value > Avg then 1 else Double.NaN; def macdRed = if Value < Avg then 1 else Double.NaN; def signal_Stoch = if RSI >= 50 and SlowK >= 50 and Value > Avg then 1 else if RSI < 50 and SlowK < 50 and Value < Avg then 0 else 0; # Balance of Power input EMA = 20; input TEMA = 20; def THL = If(high != low, high - low, 0.01); def BullOpen = (high - open) / THL; def BearOpen = (open - low) / THL; def BullClose = (close - low) / THL; def BearClose = (high - close) / THL; def BullOC = If(close > open, (close - open) / THL, 0); def BearOC = If(open > close, (open - close) / THL, 0); def BullReward = (BullOpen + BullClose + BullOC) / 1; def BearReward = (BearOpen + BearClose + BearOC) / 1; def BOP = BullReward - BearReward; def SmoothBOP = ExpAverage(BOP, EMA); def xPrice = SmoothBOP; def xEMA1 = ExpAverage(SmoothBOP, TEMA); def xEMA2 = ExpAverage(xEMA1, TEMA); def xEMA3 = ExpAverage(xEMA2, TEMA); def nRes = 3 * xEMA1 - 3 * xEMA2 + xEMA3; def SmootherBOP = nRes; def s1 = SmoothBOP; def s2 = SmootherBOP; def s3 = SmootherBOP[2]; def BOPshort = s2 < s3 and s2[1] > s3[1]; def BOPlong = s2 > s3 and s2[1] < s3[1]; # RSI IFT def over_Bought = .5; def over_Sold = -.5; def R = reference RSI(5, close) - 50; def AvgRSI = MovingAverage(AverageType.Exponential,R,9); def inverseRSI = (Power(Double.E, 2 * AvgRSI) - 1) / (Power(Double.E, 2 * AvgRSI) + 1); def RSI_IFT_Buy = (inverseRSI > 0) and (inverseRSI[1] < 0); def RSI_IFT_Sell = (inverseRSI[1] > 0) and (inverseRSI < 0); plot signal = if signal_Forecasat and signal_BB and signal_MACD and signal_RSI and signal_Stoch then 1 else 0;
I was thinking the bb line crossing would b the best exit and have a “Sell to Close”line avalible. I am not Familiar with the “MACD_BB”, perhaps I just don’t understand the terminology. But I do think an exit signal needs to be build for the RSI_IFT. What ever is easiest and beast in your opinio.@Chuck Alerts right now are not visualized on the chart and the current arrows are for the MACD crossing, which is separate than the MACD_BB. Do you think we should also add arrows to visualize the alerts too? or would it crowd the chart too much?
What might be a good idea to it have a third strategy option and that would be using that Bollinger band instead of just an alert let that place lines on the strategy.I was thinking the bb line crossing would b the best exit and have a “Sell to Close”line avalible. I am not Familiar with the “MACD_BB”, perhaps I just don’t understand the terminology. But I do think an exit signal needs to be build for the RSI_IFT. What ever is easiest and beast in your opinio.
That way you close out clean on a long entry when it comes back through the top line and your inner clean I wanna short entry well let’s say it passes over the middle line, or bottom lineWhat might be a good idea to it have a third strategy option and that would be using that Bollinger band instead of just an alert let that place lines on the strategy.
That way the gray areas which is the areas that we don’t take trades in is not involved in the buy or sell. That may be the best solution
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.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
RedK Chop & Breakout Scout V2.0 for ThinkOrSwim | Indicators | 16 | ||
G | Potential Breakout (PBO) Indicator for ThinkorSwim | Indicators | 8 | |
ThinkorSwim Stock Breakout Scanner | Indicators | 11 | ||
Potential Breakout Arrow Plots Indicator for ThinkorSwim | Indicators | 82 | ||
H | TOP Ultimate Breakout Indicator for ThinkorSwim | Indicators | 127 |
Start a new thread and receive assistance from our community.
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.
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.