Valuation Index for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
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


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);
 
A

anbu4yellow

New member
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

Top