Balance of Power Trend Indicator for ThinkorSwim

I'm testing this indicator on Nasdaq and the divergences seem to be hits every time. I might have to add this baby to the arsenal! Thanks!

One question. What is the yellow line?
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

This is a really really good indicator. In a lot of cases its better than the MACD. I'm a new member to the usethinkscript community and the things you guys post in here are extremely valuable. Thank you
 
Could someone help me out.... I would like to combine the hull moving average on top of the balance of market power. It would be fantastic if the hull moving average showed change in trend with arrows instead of the line changing colors so it would work on mobile. Thank you.
 
Last edited:
@BenTen If it isn't possible, I think it would be very useful to have an option to plot the crossing signals on an upper chart.

Thank you.
Hey John3

Here is a simple code you can edit the parameters too if you want to make subsets and then rely on those subsets for a final crossing. Currently This will paint the bars based on s1 crossing the ZeroLine. If you want a combination of how s1, s2, s3 are interacting you can do something like

A= s1>s2>s3...

and so on then in assign price color line code you edit that variable depending on the sets you have created.


Code:
def A = s1 > ZeroLine;

def B = s1 < ZeroLine;


assignpriceColor(if A then color.GREEN else color.CURRENT);
assignpriceColor(if B then color.RED else color.current);

Also here is another example you can look at that I just edited

This will paint thebars off the H/L

Code:
def A = s1 > h;

def B = s1 < l;

def D = A==0 and B==0;


assignpriceColor(if A then color.GREEN else color.CURRENT);
assignpriceColor(if B then color.RED else color.current);
assignpriceColor(if D then color.PLUM else color.current);

this one will work off the zeroline to paint the bars

Code:
def A = s1 > zeroline;

def B = s1 < zeroline;

def D = A==0 and B==0;


assignpriceColor(if A then color.GREEN else color.CURRENT);
assignpriceColor(if B then color.RED else color.current);
assignpriceColor(if D then color.PLUM else color.current);

9MSGkle.png
 
Last edited:
@mercedes FYI, when asking a question about an indicator, it is best etiquette to post the question in the thread dedicated to that indicator. This way everyone can see the indicator charted and immediately understand your question.

This is a complicated indicator to start your 1st question on as it involves divergences. You should google divergences as an understanding of them is necessary to get full use out of this indicator. Further, if you really want to delve deep into the use of the BOP, you should start by perusing the 98,700,000 results that occur when you google Balance of Power Strategy. An overview:
1Aeyne1.png

That said and to answer your question, the yellow, red, and green lines are moving averages of 34 lengths: when they cross each other and when they cross zero can signal divergences and trend reversals.

Here is a dumbed-down version of the indicator. It plots the moving averages s2 and s3 as one in a histogram so the inter-relationship between the two is lost. But the trend is more clearly illustrated. I also colored the s1 signal as positive (cyan) or not (orange) to better illustrate the possible reversal.
TqzSmbU.png

Ruby:
# MerryDay Balance of Power Trend
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/XldP1lmA/
# modified to represent s2 and s3 as a histogram @MerryDay 3/16/21

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;
def s3 = SmootherBOP[2];
def s2 = SmootherBOP;
plot MA_line = if s3 > s2 then s3 else s2 ;

ZeroLine.SetDefaultColor(GetColor(3));
h.SetDefaultColor(GetColor(3));
l.SetDefaultColor(GetColor(3));

MA_line.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
MA_line.SetLineWeight(4);
MA_line.AssignValueColor(if s2 >  s3 then color.green else
                         if s2 == s3 then color.dark_gray else color.red);

DefineGlobalColor("VividCyan", CreateColor(85, 255, 205)) ;
DefineGlobalColor("Pre_Cyan", CreateColor(50, 200, 255)) ;
s1.AssignValueColor(if s1>s1[1] and s1>0 then GlobalColor("Pre_Cyan") else
                    if s1>s1[1] and s1>-1 then color.gray else
                    if s1<s1[1] then color.orange else color.gray);
s1.SetLineWeight(2);
It is important to read the many google results before using this indicator. Also note, that just because a trend reversed, this indicator makes no promises that the trend will continue. So it is important to utilize it w/ additional indicators.

I do not use this indicator myself. It shows some similarities to the TOS indicator Leavitt Slope.
HTH
 
Last edited:
@mercedes FYI, when asking a question about an indicator, it is best etiquette to post the question in the thread dedicated to that indicator. This way everyone can see the indicator charted and immediately understand your question.

This is a complicated indicator to start your 1st question on as it involves divergences. You should google divergences as an understanding of them is necessary to get full use out of this indicator. Further, if you really want to delve deep into the use of the BOP, you should start by perusing the 98,700,000 results that occur when you google Balance of Power Strategy. An overview:
1Aeyne1.png

That said and to answer your question, the yellow, red, and green lines are moving averages of 34 lengths: when they cross each other and when they cross zero can signal divergences and trend reversals.

Here is a dumbed-down version of the indicator. It plots the moving averages s2 and s3 as one in a histogram so the inter-relationship between the two is lost. But the trend is more clearly illustrated. I also colored the s1 signal as positive (cyan) or not (orange) to better illustrate the possible reversal.
TqzSmbU.png

Ruby:
# MerryDay Balance of Power Trend
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/XldP1lmA/
# modified to represent s2 and s3 as a histogram @MerryDay 3/16/21

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;
def s3 = SmootherBOP[2];
def s2 = SmootherBOP;
plot MA_line = if s3 > s2 then s3 else s2 ;

ZeroLine.SetDefaultColor(GetColor(3));
h.SetDefaultColor(GetColor(3));
l.SetDefaultColor(GetColor(3));

MA_line.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
MA_line.SetLineWeight(4);
MA_line.AssignValueColor(if s2 >  s3 then color.green else
                         if s2 == s3 then color.dark_gray else color.red);

DefineGlobalColor("VividCyan", CreateColor(85, 255, 205)) ;
DefineGlobalColor("Pre_Cyan", CreateColor(50, 200, 255)) ;
s1.AssignValueColor(if s1>s1[1] and s1>0 then GlobalColor("Pre_Cyan") else
                    if s1>s1[1] and s1>-1 then color.gray else
                    if s1<s1[1] then color.orange else color.gray);
s1.SetLineWeight(2);
It is important to read the many google results before using this indicator. Also note, that just because a trend reversed, this indicator makes no promises that the trend will continue. So it is important to utilize it w/ additional indicators.

I do not use this indicator myself. It shows some similarities to the TOS indicator Leavitt Slope.
HTH
I really appreciated. Thanks for your help.
 
Hi,

Maybe you can help me with this I'm having a problem with this code for the Balance of Power Trend Indicator

I copied and pasted this Indicator Balance of Power Trend Indicator for ThinkorSwim, and it works on some stocks but not on others. Here are some stock charts that it's not working on, The Data line stays at the top and the H, I, and ZeroLine are all stuck together at the bottom of the Box along with S1, S2 and S3 all bunched together at the bottom. Can you tell me what you think I'm doing wrong..

EX: Balance of Power Trend does on work on these stocks NIO, AMC, SHI, GME, TLND, just mention a few but it does work on these stocks BDRBF, FDCT, GPL, ITRM, MRMD, WKSP, and NDVAF .

Thank you
 
@StarGateSunRise
There are multiple scripts in this thread. I went to the effort of installing several of them and they seem to be working fine for the stocks you listed.
sRJw8cR.png

If you want more assistance. We need ALL the information listed in these guidelines. Providing incomplete information impedes our ability to assist you and clutters the forums. HTH
 
Last edited:
Beste kan je me helpen ik ben je zeer dank baar ik wil graag deze indicator
 
Last edited by a moderator:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
271 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