Overlapping lower studies RSI, Williams%, and OBV

lmk99

Active member
VIP
Hello all,

This is my first post here, just started lurking last week and decided that I would love to try out an indicator that HuffMac90 recommended in an old thread, but I'm stuck on how to add this into a TOS lower chart:

Basis is utilizing a RSI (8, 70, 30 (green zone)) with a 20 & 80 (yellow zone) and 10 & 90 (red zone), then a Williams%r set to (8, -20,-70), and an On Balance Volume (OBV).

In his example, he showed this lower chart:

pVxqFLQ.jpg


I just started using Thinkscript a few weeks ago for very basic customization of columns in my scanners, modifying scanners, etc. but have not been able to figure out how to write code for a custom lower chart in TOS that would replicate the above. Can someone help with figuring out how to create an equivalent to this chart in the above screenshot?
 
Last edited:

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Looks like a bunch of lower studies being stacked together into one section. This would create scaling issues. I don't recommend it.
 

lmk99

Active member
VIP
Thanks for your reply. I also had read that it would be necessary, when combining lower studies into one section, to find one zoom level or scale that seems to work reliably and then not change that, because of the scaling problem.

I read that using relative threshold triggers (like if the values' relationships to each other from the different studies are within a certain percentage, give different weighted scores that can add up to a total of 1 to confirm a crossover) could be a solution, but I'm not looking to do something that complicated. I was intending to combine this with other indicators because I understand using it by itself would give unreliable results.

PS: I found a YouTube video that answered my question about how to combine the indicators into one section:

 

kryptoniken

New member
Could someone please help me to combine these 3 indicators(FW,MACD,REVERSE RSI) into one script? I'm trying to see if I can get the indicators lines stay put instead of moving up/down as when we scroll back and forth. Thanks

1)FW_DPO_MOBO

Code:
declare lower;

input price = CLOSE;
input colorNormLength = 3;
input dpoLength = 14;
input moboDisplace = 0;
input moboLength = 10;
input numDevDn = -0.8;
input numDevUp = 0.8;
input coloredMobo = Yes;
input coloredFill = Yes;
input breakArrows = Yes;
input moboShowMid = No;

plot DPO = Double.NaN;
plot MidlineP = Double.NaN;
plot UpperBandP = Double.NaN;
plot LowerBandP = Double.NaN;
plot Zeroline = Double.NaN;
plot BreakOutArrow = Double.NaN;
plot BreakDownArrow = Double.NaN;

2)MACD
Code:
declare lower;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;

plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);

plot Diff = Value - Avg;
plot ZeroLine = 0;

plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
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));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

3)REVERSE ENGINEERING RSI
Code:
input length = 14;
input price = close;
input rsiValue = 50.0;
input smoothingType = {default Wilders, EMA};

def coeff = rsiValue / (100 - rsiValue);
def chg = price - price[1];
def diff;
switch (smoothingType) {
case Wilders:
    diff =  (length - 1) * (WildersAverage(Max(-chg, 0), length) * coeff - WildersAverage(Max(chg, 0), length));
case EMA:
    diff =  (length - 1) * (ExpAverage(Max(-chg, 0), length) * coeff - ExpAverage(Max(chg, 0), length)) / 2;
}

def value = price + if diff >= 0 then diff else diff / coeff;
plot RevEngRSI = compoundValue(1, value[1], Double.NaN);

RevEngRSI.SetDefaultColor(GetColor(8));
 
Last edited:

MBF

Active member
2019 Donor
I wanted to know if it is at all possible to write a strategy and a scan for two different indicators that are noncongruent scales. IE; 3/10 Oscillator slow line crossing above a StochasticSlow K. Is this possible?
 

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