Valuation Index for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
Ported over to ThinkorSwim based on another indicator from TradingView called "Transactional Valuation Index-Version 2".

Updates include
Better Optimization on the levels.
Plotting only the important Highs and Lows

The extremes can be an important pivot levels.

Over and Undervalue - Gray (Column - close) (Histogram - High/Low)
Extreme conditions - Red
  • Extreme overvalue = Red
  • Extreme undervalue = Orange
rdQ14k7.png


thinkScript Code

Code:
# Transactional Valuation Index
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/dsuS3oGE-UCS-Transactional-Valuation-Index-Version-2/

declare lower;

input lbl = 5;
input sd = 0.2;

def tr = Max(close[1], high) - Min(close[1], low);

def tvic = ((close - (simpleMovingAvg(close, lbl))) / simpleMovingAvg(tr, lbl)) / sd;
def tvih = ((high - (simpleMovingAvg(close, lbl))) / simpleMovingAvg(tr, lbl)) / sd;
def ptvih = if tvih > 4.5 then tvih else double.nan;
def tvil = ((low - (simpleMovingAvg(close, lbl))) / simpleMovingAvg(tr, lbl)) / sd;
def ptvil = if tvil< -4.5 then tvil else double.nan;

plot pih = ptvih;
plot pil = ptvil;
plot tv = tvic;

pih.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
pih.AssignValueColor(if ptvih > 4 and ptvih< 8 then color.gray else if ptvih > 8 then color.red else color.white);

pil.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
pil.AssignValueColor(if ptvil< -4 and ptvil> -8 then color.white else if ptvil< -8 then color.orange else color.white);

def tv_cond = (tvic > 4 and tvic< 8) or (tvic< -4 and tvic> -8);
def tv_cond_b = tvic > 8 or tvic< -8;

tv.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
tv.AssignValueColor(if tv_cond then color.gray else if  tv_cond_b then color.CYAN else color.white);

plot ZeroLine = 0;
# plot fair_value_top = 4;
# plot fair_value_bottom = -4;
plot over = 8;
plot under = -8;
plot ex_over = 12;
plot ex_under = -12;

ZeroLine.AssignValueColor(color.gray);
over.AssignValueColor(color.dark_orange);
under.AssignValueColor(color.light_green);
ex_over.AssignValueColor(color.dark_red);
ex_under.AssignValueColor(color.dark_green);
 

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

Input period is 5 here. Is that 5 days ? Can I change it?

I added the study in tos and selected all the chem boxes for plot and labels but I don’t see any values on the right side of the chart
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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