Join useThinkScript to post your question to a community of 21,000+ developers and traders.
The yellow line.@Chence27 Please explain how are you finding out divergences ?
Hey John3@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.
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);
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);
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);
# 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);
I really appreciated. Thanks for your help.@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:
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.
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.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);
I do not use this indicator myself. It shows some similarities to the TOS indicator Leavitt Slope.
HTH
You are asking, "How to cut & paste forum indicators into the ThinkOrSwim app?"Can you please help me, I am very grateful, I would like this indicator
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
T | Initial Balance Indicator for ThinkorSwim | Indicators | 50 | |
D | RSI with On Balance Volume OBV For ThinkorSwim? | Indicators | 9 | |
C | Bull Bear Power VOID Oscillator For ThinkOrSwim | Indicators | 21 | |
Mimicking "Power X Strategy" by Markus Heitkoetter | Indicators | 400 | ||
I | PMF (Power Momentum Formula) for ThinkorSwim | Indicators | 10 |
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.