Balanced BB Breakout

Chuck

Active member
This is something I cooked up this morning. Not a lot went into it. Maybe you guys could refine it a little if you find it interesting. Any feedback welcomed. I am just learning to Thinkscroipt and learning by remixing things hear and their:

Code:
# Balanced BB Breakout Indicator

# Asymbled by Chuck Edwards

# V1.0

#################################################################
####################  TOS MARKET FORECAST #######################
#################################################################
#Edited by Chuck_E
declare lower;

plot pIntermediate = MarketForecast()."Intermediate" ;

DefineGlobalColor("Pre_Cyan", CreateColor(204, 255, 204)) ;
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;

addlabel(yes,
if pIntermediate >= 80 then "Market Forecast Bullish" else
if pIntermediate <= 20 then "Market Forecast Bearish" else
if pIntermediate>pIntermediate[1] then "Market Forecast Rising" else
if pIntermediate<pIntermediate[1] then "Market Forecast Falling" else " ",
if pIntermediate >= 80 then GlobalColor("Pre_Cyan") else
if pIntermediate <= 20 then color.red else
if pIntermediate>pIntermediate[1] then GlobalColor("LabelGreen") else
if pIntermediate<pIntermediate[1] then color.RED else color.light_gray);


################################################################
####################      MACD_BB     ##########################
################################################################
# By Eric Purdy, Thinkscripter LLC
# Modification to color scheme by Rick_K 12/26/20.
# Edited color scheme Chuck_E 02/23/21.

###### MACD
input price = close;
input BBlength = 10;
input BBNum_Dev = 1.0;
input MACDfastLength = 12;
input MACDslowLength = 26;
input fastLengthMACD = 12;
input slowLengthMACD = 26;
input MACDLength = 5;
input averageTypeMACD = AverageType.WEIGHTED;
input showBreakoutSignals = no;

def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength);
plot MACD_Dots = MACD_Data;
plot MACD_Line = MACD_Data;

plot BB_Upper = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;
plot BB_Lower = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;
plot BB_Midline = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;

BB_Upper.SetDefaultColor(Color.RED);
BB_Lower.SetDefaultColor(Color.GREEN);
BB_Midline.SetDefaultColor(Color.LIGHT_RED);
BB_Midline.SetStyle(Curve.FIRM);

MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] then color.green else color.red);
MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line >= BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line >= BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line <= BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line <= BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Line.SetLineWeight(1);

MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] then Color.green else Color.RED);
MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line > BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line > BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line < BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line < BB_Lower then Color.DARK_RED else Color.GRAY);

MACD_Dots.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MACD_Dots.SetLineWeight(1);

plot zero = 0;
zero.SetDefaultColor(Color.WHITE);
zero.SetStyle(Curve.SHORT_DASH);
zero.SetLineWeight(1);


###### Keltner Channels


input displace = 0;
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, price, length);
#def Avg = average[-displace];

def Upper_Band = average[-displace] + shift[-displace];
def Lower_Band = average[-displace] - shift[-displace];


###### 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 = price[-displace], length = BBLength2);
def MidLine = MovingAverage(bb_averageType, data = price[-displace], length = BBLength2);
def LowerBand = MidLine + Num_Dev_Dn * sDev;
def UpperBand = MidLine + Num_Dev_up * sDev;


###### Add Cloud


AddCloud(if UpperBand <= Upper_Band and LowerBand >= Lower_Band then BB_Upper else BB_Lower,  BB_Lower,  Color.YELLOW);
AddCloud( BB_Upper, BB_Lower, Color.LIGHT_RED );


###### Add Alert


def bull_cross = MACD_Line crosses above zero;
def bear_cross = MACD_Line crosses below zero;

Alert(bull_cross, "Time to Buy", Alert.BAR, Sound.Chimes);
Alert(bear_cross, "Time to Sell", Alert.BAR, Sound.Bell);


################################################################
##########   RSI/STOCASTIC/MACD CONFLUENCE COMBO   #############
################################################################
#CHANGELOG
# 2020.10.27 V1.0 [USER=6343]@cos251[/USER] - Added RSI, StochasticSlow and MACD to same indicator; this will plot only MACD but also
#                   - calculates RSI and Sotchasit; Will shade the lower plot area of the following conditions are met
#                    Shade GREEN = RSI > 50 and SlowK > 50 and (macd)Value > (macd)Avg
#                    Shade RED = RSI < 50 and SlowK < 50 and (macd)Value < (macd)Avg      
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
#               Stoch Slow 5(not14) and 3 WILDERS
#               MACD 12,26,9 WEIGHTED
#CREDITS
# requesed by "[USER=4682]@Joseph Patrick 18[/USER]"
#LINK
# [URL]https://rockwell-files.s3.amazonaws.com/PXCompanionGuide2ndEd_cover.pdf[/URL]
# Markus Heikoetter who is the author of the Power X Strategy
# [URL]https://usethinkscript.com/threads/mimicking-power-x-strategy-by-markus-heitkoetter.4283/[/URL]
#Editeded by Chuck_E


plot Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD);
plot Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
plot UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignalMACD = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignalMACD.SetHiding(!showBreakoutSignals);
DownSignalMACD.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(Color.GREEN);
Avg.SetDefaultColor(Color.RED);
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(4);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));

ZeroLine.SetDefaultColor(GetColor(0));

UpSignalMACD.SetDefaultColor(Color.UPTICK);
UpSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

DownSignalMACD.SetDefaultColor(Color.DOWNTICK);
DownSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);


###### RSI 
  
            
input lengthRSI = 7;
input over_BoughtRSI = 70;
input over_SoldRSI = 30;
input averageTypeRSI = AverageType.EXPONENTIAL;


def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);


###### Stochastic Slow   


input over_boughtSt = 80;
input over_soldSt = 20;
input KPeriod = 5;#5
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input averageTypeStoch = AverageType.WILDERS;
input showBreakoutSignalsStoch = {default "No", "On SlowK", "On SlowD", "On SlowK & SlowD"};

def SlowK = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullD;


######  Check for signals > 50 and macd Value > Avg


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;


###### Shade areas based on criteria; adjust as needed


AddCloud(if rsiGreen and stochGreen and macdGreen then Double.POSITIVE_INFINITY else Double.NaN, if rsiGreen and stochGreen then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_Green);
AddCloud(if rsiRed and stochRed and macdRed then Double.POSITIVE_INFINITY else Double.NaN, if rsiRed and stochRed then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_RED);


#################################################################
############  BALANCE OF POWER TREND ############################
#################################################################
# Assembled by BenTen at useThinkScript.com
# Converted from [URL]https://www.tradingview.com/script/XldP1lmA/[/URL]


input EMA = 20;
input TEMA = 20;
input high_l = 0.1;
input low_l = -0.1;

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


####### Vertical Lines
def short = s2 < s3 and s2[1] > s3[1];
def long = s2 > s3 and s2[1] < s3[1];

AddVerticalLine(short, close, Color.RED, Curve.SHORT_DASH);
AddVerticalLine(long, close, Color.GREEN, Curve.SHORT_DASH);

######  P/L Statement
input PandL_Label = Yes;

def orderDir = CompoundValue(1, if  s2 < s3 then 1 else if s2 > s3 then -1 else orderDir[1], 0);
def isOrder = orderDir crosses 0;
def orderCount = CompoundValue(1, if IsNaN(isOrder) then 0 else if isOrder then orderCount[1] + 1 else orderCount[1], 0);
def noBar = IsNaN(open[-1]);
def orderPrice = if isOrder then if noBar then close else open[-1] else orderPrice[1];
def profitLoss = if !isOrder or orderCount == 1
then 0
else if orderDir < 0 then orderPrice[1] - orderPrice
else if orderDir > 0 then orderPrice - orderPrice[1] else 0;
#else if orderDir > 0 then orderPrice[1] - orderPrice
#else if orderDir < 0 then orderPrice - orderPrice[1] else 0;
#def profitLoss = if !isOrder or orderCount == 1 then 0 else orderPrice - orderPrice[1];
def profitLossSum = CompoundValue(1, if IsNaN(isOrder) then 0 else if isOrder then profitLossSum[1] + profitLoss else profitLossSum[1], 0);
def orderWinners = CompoundValue(1, if IsNaN(isOrder) then orderWinners[1] else if orderCount > 1 and profitLoss > 0 then orderWinners[1] + 1 else orderWinners[1], 0);

######  Add Label


AddLabel(PandL_Label, orderCount + " Orders (" + AsPercent(orderWinners / orderCount) + ") | P/L " + AsDollars((profitLossSum / TickSize()) * TickValue()), if profitLossSum > 0 then Color.GREEN else if profitLossSum < 0 then Color.RED else Color.GRAY);





#------ End Balanced BB Breakout Indicator

 
Last edited:

Chuck

Active member
@asragov , Those vertical lines are from the Balance Of Power Indicator. It is a possible buy or sell at that specific price.
It can be adjusted to your liking. I have it set at ema 20/tma 20....It has worked in the past petty good for stocks similar to AMD on a 2 min chart. On futures I like it set at ema34/tma34 on a 15 min chart. You can check its profitability and tweak its settings by setting your chart to 1 day aggregations variables ranging from 2,3,5,10 and 15 mins. Look at the label in the P/L statement to the top left on the indicator to see how much that strategy would have profited you.

NOTE: The code needs to be modified on that portion, because I have it set to only buy 1 share of stock instesd of 100. I did that for futures contracts ....Now I cant remember how to change it back. Maybe someone could improve that and make it able to user interface adjustable shares .
 

Chuck

Active member
# Balanced BB Breakout Indicator

# Assembled by Chuck Edwards

# V1.2

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

#################################################################
#################### TOS MARKET FORECAST #######################
#################################################################
#Edited by Chuck_E
declare lower;

def pIntermediate = MarketForecast()."Intermediate" ;

DefineGlobalColor("Pre_Cyan", CreateColor(204, 255, 204)) ;
DefineGlobalColor("LabelGreen", CreateColor(0, 165, 0)) ;

AddLabel(yes,
if pIntermediate >= 80 then "Market Forecast Bullish" else
if pIntermediate <= 20 then "Market Forecast Bearish" else
if pIntermediate > pIntermediate[1] then "Market Forecast Rising" else
if pIntermediate < pIntermediate[1] then "Market Forecast Falling" else " ",
if pIntermediate >= 80 then GlobalColor("Pre_Cyan") else
if pIntermediate <= 20 then Color.RED else
if pIntermediate > pIntermediate[1] then GlobalColor("LabelGreen") else
if pIntermediate < pIntermediate[1] then Color.RED else Color.LIGHT_GRAY);


################################################################
#################### MACD_BB ##########################
################################################################
# By Eric Purdy, Thinkscripter LLC
# Modification to color scheme by Rick_K 12/26/20.
# Edited color scheme Chuck_E 02/23/21.

###### MACD
input price = close;
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);
plot MACD_Dots = MACD_Data;
plot MACD_Line = MACD_Data;

plot BB_Upper = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;
plot BB_Lower = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;
plot BB_Midline = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;

BB_Upper.SetDefaultColor(Color.RED);
BB_Lower.SetDefaultColor(Color.GREEN);
BB_Midline.SetDefaultColor(Color.LIGHT_RED);
BB_Midline.SetStyle(Curve.FIRM);

MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] then Color.GREEN else Color.RED);
MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line >= BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line >= BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line <= BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line <= BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Line.SetLineWeight(1);

MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] then Color.GREEN else Color.RED);
MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line > BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line > BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line < BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line < BB_Lower then Color.DARK_RED else Color.GRAY);

MACD_Dots.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MACD_Dots.SetLineWeight(1);

def zero = 0;



###### Keltner Channels


input displace = 0;
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, price, length);
#def Avg = average[-displace];

def Upper_Band = average[-displace] + shift[-displace];
def Lower_Band = average[-displace] - shift[-displace];


###### 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 = price[-displace], length = BBLength2);
def MidLine = MovingAverage(bb_averageType, data = price[-displace], length = BBLength2);
def LowerBand = MidLine + Num_Dev_Dn * sDev;
def UpperBand = MidLine + Num_Dev_up * sDev;


###### Add Cloud


AddCloud(if UpperBand <= Upper_Band and LowerBand >= Lower_Band then BB_Upper else BB_Lower, BB_Lower, Color.YELLOW);
AddCloud( BB_Upper, BB_Lower, Color.LIGHT_RED );


###### Add Alert


def bull_cross = MACD_Line crosses above zero;
def bear_cross = MACD_Line crosses below zero;

Alert(bull_cross, "Time to Buy", Alert.BAR, Sound.Chimes);
Alert(bear_cross, "Time to Sell", Alert.BAR, Sound.Bell);


################################################################
########## RSI/STOCASTIC/MACD CONFLUENCE COMBO #############
################################################################
#CHANGELOG
# 2020.10.27 V1.0 @cos251 - Added RSI, StochasticSlow and MACD to same indicator; this will plot only MACD but also
# - calculates RSI and Sotchasit; Will shade the lower plot area of the following conditions are met
# Shade GREEN = RSI > 50 and SlowK > 50 and (macd)Value > (macd)Avg
# Shade RED = RSI < 50 and SlowK < 50 and (macd)Value < (macd)Avg
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
# Stoch Slow 5(not14) and 3 WILDERS
# MACD 12,26,9 WEIGHTED
#CREDITS
# requesed by "@Joseph Patrick 18"
#LINK
# https://rockwell-files.s3.amazonaws.com/PXCompanionGuide2ndEd_cover.pdf
# Markus Heikoetter who is the author of the Power X Strategy
# https://usethinkscript.com/threads/mimicking-power-x-strategy-by-markus-heitkoetter.4283/
#Edited by Chuck_E


def Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD);
def Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
plot UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignalMACD = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignalMACD.SetHiding(!showBreakoutSignals);
DownSignalMACD.SetHiding(!showBreakoutSignals);

#Value.SetDefaultColor(Color.GREEN);
#Avg.SetDefaultColor(Color.RED);
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(4);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.Color("Positive and Up") else Diff.Color("Positive and Down") else if Diff < Diff[1] then Diff.Color("Negative and Down") else Diff.Color("Negative and Up"));

ZeroLine.SetDefaultColor(Color.RED);

UpSignalMACD.SetDefaultColor(Color.UPTICK);
UpSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

DownSignalMACD.SetDefaultColor(Color.DOWNTICK);
DownSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);


###### RSI


input lengthRSI = 7;
input over_BoughtRSI = 70;
input over_SoldRSI = 30;
input averageTypeRSI = AverageType.EXPONENTIAL;


def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);


###### Stochastic Slow


input over_boughtSt = 80;
input over_soldSt = 20;
input KPeriod = 5;#5
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input averageTypeStoch = AverageType.WILDERS;
input showBreakoutSignalsStoch = {default "No", "On SlowK", "On SlowD", "On SlowK & SlowD"};

def SlowK = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullD;


###### Check for signals > 50 and macd Value > Avg


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;


###### Shade areas based on criteria; adjust as needed


AddCloud(if rsiGreen and stochGreen and macdGreen then Double.POSITIVE_INFINITY else Double.NaN, if rsiGreen and stochGreen then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_GREEN);
AddCloud(if rsiRed and stochRed and macdRed then Double.POSITIVE_INFINITY else Double.NaN, if rsiRed and stochRed then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_RED);


################################################################
########## Variables #########
################################################################
#input aggPeriod = AggregationPeriod.MIN;
def aggPeriod = GetAggregationPeriod();
input paintBars = yes;
input showRSMShade = no;
input tradetype = { "long", "short", default "both" };
input showTrendLabels = no;
input showIndLabels = no;
input rangeType = { default "ADR", "ATR" };
input plotADR = yes;
input showADRZones = no;
input showADRLabels = no;


################################################################
########## Assign Price Color #########
################################################################
#AssignPriceColor
AssignPriceColor(if paintBars and RSI >= 50 and SlowK >= 50 and Value > Avg then Color.GREEN else if paintBars and RSI < 50 and SlowK < 50 and Value < Avg then Color.RED else if paintBars then Color.DARK_GRAY else Color.CURRENT);


#################################################################
############ BALANCE OF POWER TREND ############################
#################################################################
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/XldP1lmA/


input EMA = 20;
input TEMA = 20;
input high_l = 0.1;
input low_l = -0.1;

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


####### Vertical Lines
def short = s2 < s3 and s2[1] > s3[1];
def long = s2 > s3 and s2[1] < s3[1];

AddVerticalLine(short, close, Color.RED, Curve.SHORT_DASH);
AddVerticalLine(long, close, Color.GREEN, Curve.SHORT_DASH);

###### P/L Statement
input PandL_Label = Yes;

def orderDir = CompoundValue(1, if s2 < s3 then 1 else if s2 > s3 then -1 else orderDir[1], 0);
def isOrder = orderDir crosses 0;

def orderCount = CompoundValue(1, if IsNaN(isOrder) then 0 else if isOrder then orderCount[1] + 1 else orderCount[1], 0);

def noBar = IsNaN(open[-1]);

def orderPrice = if isOrder then if noBar then close else open[-1] else orderPrice[1];
def profitLoss = if !isOrder or orderCount == 1
then 0
else if orderDir < 0 then orderPrice[1] - orderPrice
else if orderDir > 0 then orderPrice - orderPrice[1] else 0;
#else if orderDir > 0 then orderPrice[1] - orderPrice
#else if orderDir < 0 then orderPrice - orderPrice[1] else 0;
#def profitLoss = if !isOrder or orderCount == 1 then 0 else orderPrice - orderPrice[1];
def profitLossSum = CompoundValue(1, if IsNaN(isOrder) then 0 else if isOrder then profitLossSum[1] + profitLoss else profitLossSum[1], 0);

def orderWinners = CompoundValue(1, if IsNaN(isOrder) then orderWinners[1] else if orderCount > 1 and profitLoss > 0 then orderWinners[1] + 1 else orderWinners[1], 0);


###### Add Label

AddLabel(PandL_Label, orderCount + " orders (" + AsPercent(orderWinners / orderCount) + ") | P/L " + AsDollars ((profitLossSum / TickSize()) * TickValue()), if profitLossSum > 0 then Color.GREEN else if profitLossSum < 0 then Color.RED else Color.GRAY);






#------ End Balanced BB Breakout Indicator
 
Last edited:

JCPantocrator

New member
VIP
@Chuck Thank you very much for putting this together. This is simply an amazing compilation. The vertical lines are especially useful. Out of the box (with EMA/TEMA 20) it works well for many of the stocks I looked at for the 1HR chart. I just now wish I can go back in time and use this last week as it would have saved me quite a bit of money on some bad trades.

Note for those who want to get the most out of it, change the EMA/TEMA values up and down, as Chuck noted, and see the impact on P/L for each stock/ticker you want to trade for the specific chart time you wish. This is really an essential element to get the most out of it.

Thanks again buddy and keep up the good work!
 
This is something I cooked up this morning. Not a lot went into it. Maybe you guys could refine it a little if you find it interesting. Any feedback welcomed. I am just learning to Thinkscroipt and learning by remixing things hear and their:

Code:
# Balanced BB Breakout Indicator

# Asymbled by Chuck Edwards

# V1.0

#################################################################
####################  TOS MARKET FORECAST #######################
#################################################################
#Edited by Chuck_E
declare lower;

plot pIntermediate = MarketForecast()."Intermediate" ;

DefineGlobalColor("Pre_Cyan", CreateColor(204, 255, 204)) ;
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;

addlabel(yes,
if pIntermediate >= 80 then "Market Forecast Bullish" else
if pIntermediate <= 20 then "Market Forecast Bearish" else
if pIntermediate>pIntermediate[1] then "Market Forecast Rising" else
if pIntermediate<pIntermediate[1] then "Market Forecast Falling" else " ",
if pIntermediate >= 80 then GlobalColor("Pre_Cyan") else
if pIntermediate <= 20 then color.red else
if pIntermediate>pIntermediate[1] then GlobalColor("LabelGreen") else
if pIntermediate<pIntermediate[1] then color.RED else color.light_gray);


################################################################
####################      MACD_BB     ##########################
################################################################
# By Eric Purdy, Thinkscripter LLC
# Modification to color scheme by Rick_K 12/26/20.
# Edited color scheme Chuck_E 02/23/21.

###### MACD
input price = close;
input BBlength = 10;
input BBNum_Dev = 1.0;
input MACDfastLength = 12;
input MACDslowLength = 26;
input fastLengthMACD = 12;
input slowLengthMACD = 26;
input MACDLength = 5;
input averageTypeMACD = AverageType.WEIGHTED;
input showBreakoutSignals = no;

def MACD_Data = MACD(fastLength = MACDfastLength, slowLength = MACDslowLength, MACDLength = MACDLength);
plot MACD_Dots = MACD_Data;
plot MACD_Line = MACD_Data;

plot BB_Upper = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).UpperBand;
plot BB_Lower = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).Lowerband;
plot BB_Midline = reference BollingerBands(price = MACD_Line, length = BBlength, Num_Dev_Dn = -BBNum_Dev, Num_Dev_Up = BBNum_Dev).MidLine;

BB_Upper.SetDefaultColor(Color.RED);
BB_Lower.SetDefaultColor(Color.GREEN);
BB_Midline.SetDefaultColor(Color.LIGHT_RED);
BB_Midline.SetStyle(Curve.FIRM);

MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] then color.green else color.red);
MACD_Line.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line >= BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line >= BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line <= BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line <= BB_Lower then Color.DARK_RED else Color.GRAY);
MACD_Line.SetLineWeight(1);

MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] then Color.green else Color.RED);
MACD_Dots.AssignValueColor(if MACD_Line > MACD_Line[1] and MACD_Line > BB_Upper then Color.GREEN else if MACD_Line < MACD_Line[1] and MACD_Line > BB_Upper then Color.DARK_GREEN else if MACD_Line < MACD_Line[1] and MACD_Line < BB_Lower then Color.RED else if MACD_Line > MACD_Line[1] and MACD_Line < BB_Lower then Color.DARK_RED else Color.GRAY);

MACD_Dots.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
MACD_Dots.SetLineWeight(1);

plot zero = 0;
zero.SetDefaultColor(Color.WHITE);
zero.SetStyle(Curve.SHORT_DASH);
zero.SetLineWeight(1);


###### Keltner Channels


input displace = 0;
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, price, length);
#def Avg = average[-displace];

def Upper_Band = average[-displace] + shift[-displace];
def Lower_Band = average[-displace] - shift[-displace];


###### 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 = price[-displace], length = BBLength2);
def MidLine = MovingAverage(bb_averageType, data = price[-displace], length = BBLength2);
def LowerBand = MidLine + Num_Dev_Dn * sDev;
def UpperBand = MidLine + Num_Dev_up * sDev;


###### Add Cloud


AddCloud(if UpperBand <= Upper_Band and LowerBand >= Lower_Band then BB_Upper else BB_Lower,  BB_Lower,  Color.YELLOW);
AddCloud( BB_Upper, BB_Lower, Color.LIGHT_RED );


###### Add Alert


def bull_cross = MACD_Line crosses above zero;
def bear_cross = MACD_Line crosses below zero;

Alert(bull_cross, "Time to Buy", Alert.BAR, Sound.Chimes);
Alert(bear_cross, "Time to Sell", Alert.BAR, Sound.Bell);


################################################################
##########   RSI/STOCASTIC/MACD CONFLUENCE COMBO   #############
################################################################
#CHANGELOG
# 2020.10.27 V1.0 [USER=6343]@cos251[/USER] - Added RSI, StochasticSlow and MACD to same indicator; this will plot only MACD but also
#                   - calculates RSI and Sotchasit; Will shade the lower plot area of the following conditions are met
#                    Shade GREEN = RSI > 50 and SlowK > 50 and (macd)Value > (macd)Avg
#                    Shade RED = RSI < 50 and SlowK < 50 and (macd)Value < (macd)Avg     
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
#               Stoch Slow 5(not14) and 3 WILDERS
#               MACD 12,26,9 WEIGHTED
#CREDITS
# requesed by "[USER=4682]@Joseph Patrick 18[/USER]"
#LINK
# [URL]https://rockwell-files.s3.amazonaws.com/PXCompanionGuide2ndEd_cover.pdf[/URL]
# Markus Heikoetter who is the author of the Power X Strategy
# [URL]https://usethinkscript.com/threads/mimicking-power-x-strategy-by-markus-heitkoetter.4283/[/URL]
#Editeded by Chuck_E


plot Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD);
plot Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
plot UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignalMACD = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignalMACD.SetHiding(!showBreakoutSignals);
DownSignalMACD.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(Color.GREEN);
Avg.SetDefaultColor(Color.RED);
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(4);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));

ZeroLine.SetDefaultColor(GetColor(0));

UpSignalMACD.SetDefaultColor(Color.UPTICK);
UpSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

DownSignalMACD.SetDefaultColor(Color.DOWNTICK);
DownSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);


###### RSI
 
           
input lengthRSI = 7;
input over_BoughtRSI = 70;
input over_SoldRSI = 30;
input averageTypeRSI = AverageType.EXPONENTIAL;


def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);


###### Stochastic Slow  


input over_boughtSt = 80;
input over_soldSt = 20;
input KPeriod = 5;#5
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input averageTypeStoch = AverageType.WILDERS;
input showBreakoutSignalsStoch = {default "No", "On SlowK", "On SlowD", "On SlowK & SlowD"};

def SlowK = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullD;


######  Check for signals > 50 and macd Value > Avg


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;


###### Shade areas based on criteria; adjust as needed


AddCloud(if rsiGreen and stochGreen and macdGreen then Double.POSITIVE_INFINITY else Double.NaN, if rsiGreen and stochGreen then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_Green);
AddCloud(if rsiRed and stochRed and macdRed then Double.POSITIVE_INFINITY else Double.NaN, if rsiRed and stochRed then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_RED);


#################################################################
############  BALANCE OF POWER TREND ############################
#################################################################
# Assembled by BenTen at useThinkScript.com
# Converted from [URL]https://www.tradingview.com/script/XldP1lmA/[/URL]


input EMA = 20;
input TEMA = 20;
input high_l = 0.1;
input low_l = -0.1;

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


####### Vertical Lines
def short = s2 < s3 and s2[1] > s3[1];
def long = s2 > s3 and s2[1] < s3[1];

AddVerticalLine(short, close, Color.RED, Curve.SHORT_DASH);
AddVerticalLine(long, close, Color.GREEN, Curve.SHORT_DASH);

######  P/L Statement
input PandL_Label = Yes;

def orderDir = CompoundValue(1, if  s2 < s3 then 1 else if s2 > s3 then -1 else orderDir[1], 0);
def isOrder = orderDir crosses 0;
def orderCount = CompoundValue(1, if IsNaN(isOrder) then 0 else if isOrder then orderCount[1] + 1 else orderCount[1], 0);
def noBar = IsNaN(open[-1]);
def orderPrice = if isOrder then if noBar then close else open[-1] else orderPrice[1];
def profitLoss = if !isOrder or orderCount == 1
then 0
else if orderDir < 0 then orderPrice[1] - orderPrice
else if orderDir > 0 then orderPrice - orderPrice[1] else 0;
#else if orderDir > 0 then orderPrice[1] - orderPrice
#else if orderDir < 0 then orderPrice - orderPrice[1] else 0;
#def profitLoss = if !isOrder or orderCount == 1 then 0 else orderPrice - orderPrice[1];
def profitLossSum = CompoundValue(1, if IsNaN(isOrder) then 0 else if isOrder then profitLossSum[1] + profitLoss else profitLossSum[1], 0);
def orderWinners = CompoundValue(1, if IsNaN(isOrder) then orderWinners[1] else if orderCount > 1 and profitLoss > 0 then orderWinners[1] + 1 else orderWinners[1], 0);

######  Add Label


AddLabel(PandL_Label, orderCount + " Orders (" + AsPercent(orderWinners / orderCount) + ") | P/L " + AsDollars((profitLossSum / TickSize()) * TickValue()), if profitLossSum > 0 then Color.GREEN else if profitLossSum < 0 then Color.RED else Color.GRAY);





#------ End Balanced BB Breakout Indicator

Hi Chuck, any chance for a scan for when one of the alerts or lines change color signaling sell or buy? Thanks
 

Chuck

Active member
Hi Chuck, any chance for a scan for when one of the alerts or lines change color signaling sell or buy? Thanks
@Joseph Patrick 18, Hopefully you downloaded the updated version. The original sript posted did not have my defaulted settings. Editied the latest post to reflect. I am not a good coder, I just mixed this all together from some of my favorite lower indicators to have a all in one. Edited out a few conflicts. Maybe someone here can create a scan. but this is still experimental, use with caution.
 
@Joseph Patrick 18, Hopefully you downloaded the updated version. The original sript posted did not have my defaulted settings. Editied the latest post to reflect. I am not a good coder, I just mixed this all together from some of my favorite lower indicators to have a all in one. Edited out a few conflicts. Maybe someone here can create a scan. but this is still experimental, use with caution.
Thanks Chuck, I did and it looks awesome! Thanks!
Quick question on how to use the chart for entry and exit signals.

In the pic below would I enter at when the MACD dots turn from red to green and rises above the other MA's, while also getting the green vertical line @$168.70 with the beginning of the green shadow forming? (the 2 green arrows in pic below)

Also to exit (arrow number 2 in pic below) I would wait for the MACD dots to reverse and go from green to red while crossing below the MA's and the green shading ends?? (even tho the green shade ended at $178.70)??



Thanks for your help.
Joe
 

Chuck

Active member
Joe,
The first thing I do is backtest it on the instrument I want to trade. Using a one day chart with time intervals of 2m,3m,5m,10m,15m, etc. and check out the P/L to see what time frame is the most profitable, considering my risk and max drawdown.

Next I adjust the fast length macd, so that it matches my optimal entry/exit points on that timeframe.

After that to answer your question I watch the MACD line. Before the line turns grey it should turn dark red or dark green. Thats when I am alerted. I use that as my lead while using this indicator.

When the MACD line turns grey, that is an area of indecision and as soon as that line crosses the middle BB line, I look for secondary confirmation to confirm entry or exit, I do this on entries and exits.

I have all the arrows turned on on my version and I look for the arrows, or histogram, or colored cloud background, or balance of power line with price level for my entries also considering the other signals and price indications I am getting from the candles and other indicators in my final evaluation.
 
Last edited:
Joe,
The first thing I do is backtest it on the instrument I want to trade. Using a one day chart with time intervals of 2m,3m,5m,10m,15m, etc. and check out the P/L to see what time frame is the most profitable, considering my risk and max drawdown.

Next I adjust the fast length macd, so that it matches my optimal entry/exit points on that timeframe.

After that to answer your question I watch the MACD line. Before the line turns grey it should turn dark red or dark green. Thats when I am alerted. I use that as my lead while using this indicator.

When the MACD line turns grey, that is an area of indecision and as soon as that line crosses the middle BB line, I look for secondary confirmation to confirm entry or exit, I do this on entries and exits.

I have all the arrows turned on on my version and I look for the arrows, or histogram, or colored cloud background, or balance of power line with price level for my entries also considering the other signals and price indications I am getting from the candles and other indicators in my final evaluation.

Awesome! Thank you Chuck for the explanation, appreciate it and I'll let you know how I do. Thanks
 
Last edited:

Chuck

Active member
Joe,

Some people may want to enter upon the bollinger band crossing that will be for earlier trade enties/exits. You will have to play with it and figure out what works best for you. I updated the link and the second post to add paint bars. I am not a coder and would not recommend trading live until all the kinks are worked out. I see several of the indicators on this forum were designed because of your requests. Perhaps you can reach out and get one of these guys to tweak this thing up a bit if you like it.
 

JE $$

New member
VIP
Joe,
The first thing I do is backtest it on the instrument I want to trade. Using a one day chart with time intervals of 2m,3m,5m,10m,15m, etc. and check out the P/L to see what time frame is the most profitable, considering my risk and max drawdown.

Next I adjust the fast length macd, so that it matches my optimal entry/exit points on that timeframe.

After that to answer your question I watch the MACD line. Before the line turns grey it should turn dark red or dark green. Thats when I am alerted. I use that as my lead while using this indicator.

When the MACD line turns grey, that is an area of indecision and as soon as that line crosses the middle BB line, I look for secondary confirmation to confirm entry or exit, I do this on entries and exits.

I have all the arrows turned on on my version and I look for the arrows, or histogram, or colored cloud background, or balance of power line with price level for my entries also considering the other signals and price indications I am getting from the candles and other indicators in my final evaluation.
Hey Chuck, thanks for your explanation and for your work with this. Would you mind explaining further how you make the decision about what to adjust the MACD fast length to?
1)first you look at the P/L and how it differs based on changing the timeframe - so if 5m looks better than 3, you'd probably go with 5m
2)then you adjust the MACD fast line - this is the part i'm having difficulty with - what do you do to figure out how you should adjust it?
 

Chuck

Active member
Hey Chuck, thanks for your explanation and for your work with this. Would you mind explaining further how you make the decision about what to adjust the MACD fast length to?
1)first you look at the P/L and how it differs based on changing the timeframe - so if 5m looks better than 3, you'd probably go with 5m
2)then you adjust the MACD fast line - this is the part i'm having difficulty with - what do you do to figure out how you should adjust it?
@JE $$ ,

I like to have probability in my favor. that’s why I put that strategy on my lower indicators.

For each instrument that I trade I can run a P/L analysis.

Once that’s locked into the optimal time frame, I like to adjust other indicators or in this instance studies within the indicator for maximum performance.

I personally open the study and adjust the fast length macd.

I adjust the fast length MACD by while looking at the histogram while trying to optimize it to the perfect high/ low pivot points.
I like to send it to eight out of 10 occurrences.

That is just my personal preference
 

JE $$

New member
VIP
@JE $$ ,

I like to have probability in my favor. that’s why I put that strategy on my lower indicators.

For each instrument that I trade I can run a P/L analysis.

Once that’s locked into the optimal time frame, I like to adjust other indicators or in this instance studies within the indicator for maximum performance.

I personally open the study and adjust the fast length macd.

I adjust the fast length MACD by while looking at the histogram while trying to optimize it to the perfect high/ low pivot points.
I like to send it to eight out of 10 occurrences.

That is just my personal preference
Chuck -thanks
 
Joe,

Some people may want to enter upon the bollinger band crossing that will be for earlier trade enties/exits. You will have to play with it and figure out what works best for you. I updated the link and the second post to add paint bars. I am not a coder and would not recommend trading live until all the kinks are worked out. I see several of the indicators on this forum were designed because of your requests. Perhaps you can reach out and get one of these guys to tweak this thing up a bit if you like it.
Okay will do. Thanks Chuck for helping me out and I will try and reach out to try to get someone to help.

Joe
 

Similar threads

Top