Stocks & Commodities V. 30:7 (8, 64): Letters To S&C by Technical Analysis, Inc.

Stocks & Commodities V. 30:7 (8, 64): Letters To S&C by Technical Analysis, Inc.
Item# 339LETTPDF
Availability: In Stock

Product Description

Letters To S&C by Technical Analysis, Inc.



I was going through the May 2012 article on the choppiness index (“Fractal Energies” by Doc Severson) and the code given for thinkorswim. I have copied & pasted the code from the article, but it’s giving me an error at the following line:

#Plot1(100 * Log(Summation (TrueRange,Len) / (Highest(C[1],Len) - Lowest(C[1],Len)) / Log(Len)), "CI2");

Can you help? John Parbhu

Author Doc Severson replies:

That instruction needs to be on one line for it to work correctly.

If you format that line of code so that it is entered in thinkorswim as one line, it will work fine. I will show the code listing again here, with the command in question highlighted in red, but keep in mind it is difficult to show the code listing correctly on the printed page with the formatting and line breaks that the printed page imposes.

# { CI: Choppiness Index } declare lower;

# Inputs: Len(13); input Len = 14; input CIx = {default CI3, CI2};

#Plot1(100 * Log(Summation(TrueRange,Len)/(Highest(C[1],Len) - Lowest(C[1],Len))/Log(Len)), "CI2"); def CI2 = 100 * log( Sum( TrueRange(high,close,low),Len) ) / ( Highest(close[1],Len) - Lowest(close[1],Len)) / log(Len);

def CI3 = ( ( log(Sum(TrueRange(high,close,low),Len) / ( Highest(if high >= close[1] then high else close[1],Len) - Lowest( if low <= close[1] then low else close[1],Len) ) ) / log(10) ) / (log(Len)/log(10)) ) * 100;

plot CI = if CIx == CIx.CI3 then CI3 else CI2; CI.AssignValueColor( Color.Blue);

# Plot2(60,"60Li"); plot line60 = 60; line60.AssignValueColor(Color.DARK_GREEN);

# Plot3(35,"35Li"); plot line35 = 35; line35.AssignValueColor(Color.BLACK);

Editor: Subscribers will find this code listing at the Subscriber’s Area of our website.

*Note: $2.95-$5.95 Articles are in PDF format only. No hard copy of the article(s) will be delivered. During checkout, click the "Download Now" button to immediately receive your article(s) purchase. STOCKS & COMMODITIES magazine is delivered via mail. After paying for your subscription at users can view the S&C Digital Edition in the subscriber's section on

Take Control of Your Trading.
Professional Traders' Starter Kit
All these items shown below only $299.99!
  • 5-year subscription to Technical Analysis of STOCKS & COMMODITIES, The Traders' magazine. (Shipping outside the US is extra. Washington state addresses require sales tax based on your locale.)
  • 5 year access to S&C Archive
  • 5 year access to S&C Digital Edition
  • 5-year subscription to Advantage.
  • 5-year subscription to Working Money.
  • Free book selection.
  • Click Here to Order