Study on a Study; then scale the study with the other?

Mal

New member
Hi All,

I have a strategy that I want to implement on TOS, but it rely's on indicators being set up the same way on another charting platform called TC2000. TC2000 allows you to overlay indicators and then has a feature to allow you take each indicator and scale it with another indicator you have overlayed. I do not see any scaling features on TOS so I am thinking unfortunately the code for the indicator would have to modified to provide the scaling.

Below shows an identical chart and setup for both TOS and TC2000 so you can see the visual difference that scaling creates in TC2000.

On the left is the TOS version; right is TC2000. The 2 indicators are at the bottom; the RSI 2 and the ADX 10. In the TC2000 picture the ADX indicator has been "Scaled with the RSI 2 indicator". TOS does not allow you to do this and you can see from the 2 pictures how different the ADX indicator looks on both.

Question:

1) Am I missing something on TOS that would allow this scaling to be done?
2) If there is nothing in TOS that would allow this scaling feature, does anyone understand exactly what the scaling might be doing to be able to say if the TOS ADX indicator could be changed to mimic this scaling feature in TC2000?

Really appreciate any help at all. My only other alternative is to subscribe to a monthly data plan with TC2000 which I really do not want to do as I do all of my trading / charting with TOS and have real time data there.

HPo8CHq.jpg
 
Code:
# RSI and ADX combined in one study. Horserider 2/29/2020
declare lower;

input lengthadx = 14;
input averageType = AverageType.WILDERS;

plot ADX = DMI(lengthadx, averageType).ADX;
ADX.setDefaultColor(GetColor(5));



input lengthrsi = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageTypersi = AverageType.WILDERS;
input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageTypersi, price - price[1], lengthrsi);
def TotChgAvg = MovingAverage(averageTypersi, AbsValue(price - price[1]), lengthrsi);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;

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

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
 
Code:
# RSI and ADX combined in one study. Horserider 2/29/2020
declare lower;

input lengthadx = 14;
input averageType = AverageType.WILDERS;

plot ADX = DMI(lengthadx, averageType).ADX;
ADX.setDefaultColor(GetColor(5));



input lengthrsi = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageTypersi = AverageType.WILDERS;
input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageTypersi, price - price[1], lengthrsi);
def TotChgAvg = MovingAverage(averageTypersi, AbsValue(price - price[1]), lengthrsi);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;

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

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Holy smokes that was fast :)
I applied it and it worked! Matches TC2000 perfectly.
Thank you very much Horserider, this is awesome, I was preparing myself for the response that is cannot be done or or incredibly difficult. I am looking at the code now to see if I can figure it out (i have not programmed any Thinkscript).
I actually have another indicator i also want to overlay on the RSI as well as this one; the "DMI" indicator. I posted the easiest question first just to see if it is possible and was hoping to get a response so that I can look into it and see if I can do the DMI myself. I am looking at the code you sent now along with the DMI base code and trying to figure out first the concept of what has changed from the original code.

If it easy for you to do and if you are bored lol if you want to take a shot at adding the DMI into this all that would be great. I am going to see if I can figure it out. Will check back if I am stumped.
Thanks one again!
 
Nothing. All on same scale. So erase ADX code and Copy and paste the DMI code.
Unreal, it worked :). I am lacking some concepts in how this all works, will dig into it now that it works to see if I can understand. I can't thank you enough for the quick help on this. Glad it was not all that complicated.
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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