Sat12072013

Last update09:42:00 AM

## THINKORSWIM: AUGUST 2013

In “Within The Volatility Band” in this issue, author Sylvain Vervoort continues with his fourth installment in his seven-part series. This month, he focuses on using historical price movements to define price volatility and builds price bands using those numbers. His price volatility is found by using a common technical analysis statistic, average true range. For thinkorswim users, we have created a strategy in our proprietary scripting language, thinkScript. You can adjust the parameters of the strategy within the Edit Studies window to fine tune the periods calculated.

A sample chart is shown in Figure 3.

Figure 3: THINKORSWIM. Here is an example of a strategy implemented in thinkorswim based on Sylvain Vervoort’s article in this issue. The strategy is based on average true range and uses historical price movements to define price volatility. It builds price bands using those numbers.

The study:

1. From TOS charts, select Studies → Edit studies
2. Select the Studies tab in the upper left-hand corner
3. Select “New” in the lower left-hand corner
4. Name the study (such as “VolatilityBand”)
5. Click in the script editor window, remove “addOrder(Order Type.BUY_AUTO, no);” and paste in the following code:
input price = hlc3;
input averageLength = 8;
input volatilityLength = 13;
input deviationFactor = 3.55;
def typical = if price >= price[1] then price - low[1] else price[1] - low;
def deviation = deviationFactor * Average(typical, volatilityLength);
def devHigh = ExpAverage(deviation, averageLength);
def devLow = lowBandAdjust * devHigh;
def medianAvg = ExpAverage(price, averageLength);
plot MidLine = Average(medianAvg, averageLength);
plot UpperBand = ExpAverage(medianAvg, averageLength) + devHigh;
plot LowerBand = ExpAverage(medianAvg, averageLength) - devLow;
LowerBand.SetDefaultColor(GetColor(1));
MidLine.SetDefaultColor(GetColor(7));
UpperBand.SetDefaultColor(GetColor(0));
AddOrder(OrderType.BUY_AUTO, close > UpperBand, name = "VolatilityBandLE", tickcolor = GetColor(0), arrowcolor = GetColor(0));
AddOrder(OrderType.SELL_AUTO, close < LowerBand, name = "VolatilityBandLE", tickcolor = GetColor(1), arrowcolor = GetColor(1));

—thinkorswim
A division of TD Ameritrade, Inc.
www.thinkorswim.com