Any additions or modifications to the indicator is welcome.
Code:
#####
## Bull Bear Power Trend by Dreadblitz
## https://www.tradingview.com/v/wjlDy5tV/
##
##Converted by Zurika (ApoZee)
##
####
declare lower;
# I took the length out because I am not using the Reg_Trend
# input length = 8;
def bulltr_hist = 0.0;
def beartr_hist = 0.0;
def bullTrend = (close - Lowest(low, 50)) / ATR(5);
def bearTrend = (Highest(high, 50) - close) / ATR(5);
def bearTrend2 = -1 * bearTrend;
def trend = bullTrend - bearTrend;
plot bull = bullTrend;
bull.SetDefaultColor(color = Color.GREEN);
plot bear = bearTrend2;
bear.SetDefaultColor(color = Color.RED);
def bullComp = if bullTrend < 2 then bulltr_hist else bullTrend - 2;
plot bull_hist = bullComp;
bull_hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
bull_hist.SetDefaultColor(GetColor(6));
bull_hist.SetLineWeight(3);
def bearComp = if bearTrend2 > -2 then beartr_hist else bearTrend2 + 2;
plot bear_hist = bearComp;
bear_hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
bear_hist.SetDefaultColor(GetColor(5));
bear_hist.SetLineWeight(3);
plot trendline = trend;
trendline.SetDefaultColor(GetColor(1));
trendline.SetLineWeight(2);
plot zline = 0;
zline.SetDefaultColor(GetColor(4));
plot pline = 2;
pline.SetDefaultColor(GetColor(3));
pline.SetStyle(Curve.SHORT_DASH);
plot nline = -2;
nline.SetDefaultColor(GetColor(4));
nline.SetStyle(Curve.SHORT_DASH);
#Bull Cloud
AddCloud(bull, pline,Color.GREEN, Color.LIME, yes);
#Bear Cloud
AddCloud(bear, nline, Color.PINK, Color.RED, yes);
#def x = barNumber();
#def y = trend;