This indicator will help you determine the strength of bulls and bears. It's similar to the default Balance Of Market Power in ThinkorSwim but with additional bells and whistles.
- Above the Zero line is bullish
- Below the Zero line is considered bearish
Code:
# Balance of Power Trend
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/XldP1lmA/
declare lower;
input EMA = 34;
input TEMA = 34;
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) / 3;
def BearReward = (BearOpen + BearClose + BearOC) / 3;
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;
plot h = high_l;
plot l = low_l;
plot ZeroLine = 0;
plot s1 = SmoothBOP;
plot s2 = SmootherBOP;
plot s3 = SmootherBOP[2];
ZeroLine.SetDefaultColor(GetColor(3));
h.SetDefaultColor(GetColor(3));
l.SetDefaultColor(GetColor(3));