Site Meter The Lawyer Trader: ThinkScript Indicator: CalmvVolatile

Sunday, December 7, 2014

ThinkScript Indicator: CalmvVolatile

This is a pretty basic stud that compares the current Average True Range (ATR) with a long term average of the ATR.  The default periods are 14 period for the ATR and 500 period for the average.


This indicator can be helpful as a quick reference when taking short term trades.  If the instrument is volatile, you know that there's a better possibility of a quicker and farther move than if it's calm.  Enjoy.  The code is below.


#######Delete this line in TOS#############

input atrlength = 14;

input avglength = 500;

input plotlower = {default "yes", "no"};

def vol = AverageTrueRange(atrlength);

def avgvol = Average(vol, avglength);

def calm = vol < avgvol - (avgvol * .1);

def neutral = avgvol + (avgvol * .1) > vol > avgvol - (avgvol * .1);

def Volatile = vol > avgvol + (avgvol * .1);

AddLabel(yes, Concat("Market is Currently ", (if calm then "Calm" else if neutral then "Neutral" else if Volatile then "Volatile" else "Neutral")),  if calm then Color.GREEN else if neutral then Color.BLUE else if Volatile then Color.RED  else Color.GRAY);

declare lower;

plot window =  vol - avgvol;

window.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

window.AssignValueColor(if Volatile then Color.RED else if calm then Color.GREEN else if neutral then Color.BLUE else Color.GRAY);

plot zeroline = 0;

######delete this line in TOS##############

2 comments:

QL said...

Hi,

Does the following indicator work in the latest thinkorswim? I tried briefly, but didn't make it work.
thanks!

http://thelawyertrader.blogspot.com/2011/09/index-trader-indicator-for-think-or.html

Jack

TLT said...

TraderZ,

I don't know if it does or not. I haven't been on think or swim or quite a while. The coding might need to be edited for a new version.

TLT