Fri05242013

Last update12:00:00 AM

BackHomeS&C MagazineDepartmentsTraders' Tips TRADESTATION: VOLUME ZONE OSCILLATOR

TRADESTATION: VOLUME ZONE OSCILLATOR

In the article “In The Volume Zone” in this issue, authors Walid Khalil and David Steckler present a volume zone oscillator (Vzo) that can be used to incorporate both trending and oscillating price action. They also suggest some methods by which the Vzo can be used with other indicators and rules for trading.

We have prepared code for this indicator (_Vzo_Ind) and a strategy (_Vzo_Strategy). The strategy utilizes the 60-bar Ema of the close, the volume zone oscillator, and the 14-barAdx. An Adx above 18 is considered trending, while below 18 is considered nontrending, according to the authors. Alerts were coded in the indicator to alert when the Vzo crosses the overbought and oversold values as set by the inputs.

To download the EasyLanguage code for the indicator, go to the TradeStation and EasyLanguage Support Forum (https://www.tradestation.com/Discussions/forum.aspx?Forum_ID=213) and search for the file “Vzo.Eld.” The code is also shown here. A sample chart is shown in Figure 1.

FIGURE 1: TRADESTATION, VOLUME ZONE OSCILLATOR. This shows a daily chart of SPY with several indicators and the “_VZO_Strategy” applied. The indicators include the _VZO_Ind (cyan plot in subgraph 2), 60-bar EMA of the close (red plot with the price data), and the custom two-lines indicator (subgraph 3) plotting the 14-bar ADX (yellow) and the value of 18 (cyan line). The value of 18 for the ADX is the breakpoint for trending versus nontrending, according to the authors.

_VZO_Ind (Indicator)
{ TASC Article, May, 2011, "In The Volume Zone" }
{ Volume Zone Oscillator }
inputs:
Period( 14 ),
OverBought( 40 ),
OverSold( -40 ) ;		
variables:
MV( 0 ),
R( 0 ),
VP( 0 ),
TV( 0 ),
VZO( 0 ) ;
MV = Iff(BarType >= 2 and BarType < 5, Volume, Ticks) ;
R = Sign( C - C[1] ) * MV ;
VP = XAverage( R, Period ) ;
TV = XAverage( MV, Period ) ;
if TV <> 0 then	VZO = VP / TV * 100 ;
Plot1( VZO, "VZO" ) ;
Plot2( 60, "+60" ) ;
Plot3( 40, "+40" ) ;
Plot4( 15, "+15" ) ;
Plot5( -5, "-5" ) ;
Plot6( -40, "-40" ) ;
Plot7( -60, "-60" ) ;
Plot8( 0, "Zero" ) ;
if VZO crosses above OverBought then
Alert( "VZO Overbought" ) ;
if VZO crosses below OverSold then
Alert( "VZO Oversold" ) ;
_VZO_Strategy (Strategy)
{ TASC Article, May, 2011, "In The Volume Zone" }
{ Volume Zone Oscillator Strategy }
[IntrabarOrderGeneration = false]
inputs:
Period( 14 ), { Volume Zone Oscillator Length }
EMALen( 60 ), { Number of bars for EMA }
ADXLen( 14 ), { Length for ADX }
ADXTrendAmt( 18 ), { ADX Value for Trend }
OverBought( 40 ), { VZO overbought value }
OverSold( -40 ) ; { VZO oversold value }		
variables:
EMA( 0 ),
ADXTrending( false ),
MV( 0 ),
R( 0 ),
VP( 0 ),
TV( 0 ),
VZOMaxHigh( 0 ),
MaxCompare( 0 ),
VZOMinLow( 0 ),
MinCompare( 0 ),
PrevPriceHigh( 9999999 ),
PrevPriceLow( 0 ),
BullishDiv( false ),
BearishDiv( false ),
PrevVZOHigh( 0 ),
PrevVZoLow( 0 ),
VZO( 0 ) ;
EMA = XAverage( C, EMALen ) ; { EMA of the Close }
ADXTrending = ADX( ADXLen ) > ADXTrendAmt ;
MV = Iff(BarType >= 2 and BarType < 5, Volume, Ticks) ;
R = Sign( C - C[1] ) * MV ;
VP = XAverage( R, Period ) ;
TV = XAverage( MV, Period ) ;
if TV <> 0 then
VZO = VP / TV * 100 ;
MaxCompare = Iff( ADXTrending, 60, 40 ) ;
MinCompare = Iff( ADXTrending, -60, -40 ) ;
if VZO > MaxCompare then
VZOMaxHigh = MaxList( VZOMaxHigh, VZO )
else 
VZOMaxHigh = -999 ;
if VZO < MinCompare then
VZOMinLow = MinList( VZOMinLow, VZO )
else
VZOMinLow = 999 ;
{ Pivot High of VZO - look for divergence }
if PivotHighVSBar( 1, VZO, 1, 1, 2 ) <> -1 then
begin
if H[1] > PrevPriceHigh and 
VZO[1] < PrevVZOHigh then
BearishDiv = true
else
BearishDiv = false ;
PrevPriceHigh = H[1] ;
PrevVZOHigh = VZO[1] ;
end
else
BearishDiv = false ;
{ Pivot Low of VZO - look for divergence }
if PivotLowVSBar( 1, VZO, 1, 1, 2 ) <> -1 then 
begin
if L[1] < PrevPriceLow and 
VZO[1] > PrevVZOLow then
BullishDiv = true
else
BullishDiv = false ;
PrevPriceLow = L[1] ;
PrevVZOLow = VZO[1] ;
end 
else
BullishDiv = false ;
{------------------------------------------------
ENTRIES
-------------------------------------------------}
{ Long Entry Conditions - Trending }
Condition1 = C > EMA and ADXTrending ;
Condition2 = VZO crosses above OverSold ;
if Condition1 and Condition2 then
Buy ( "OS Rev LE" ) next bar market ;
if VZO crosses below 40 then
Condition3 = true
else if VZO crosses below -40 then
Condition3 = false ;
if Condition3 and VZO crosses above 0 then
begin
Condition4 = true ; { Long entry trigger }
Condition3 = false ;
end ;
if Condition1 and Condition4 then
begin
Buy ( "LE Trend 2" ) next bar market ;
end ;
{ Short Entry Conditions - Trending }
Condition11 = C < EMA and ADXTrending ;
Condition12 = VZO crosses below OverBought ;
if Condition11 and Condition12 then
SellShort ( "OB Rev SE" ) next bar market ;
if VZO crosses above -40 then
Condition13 = true
else if VZO crosses above 40 then
Condition13 = false ;
if Condition13 and VZO crosses below 0 then
begin
Condition14 = true ; { Short entry trigger }
Condition13 = false ;
end ;
if Condition11 and Condition14 then
SellShort( "SE Trend 2" ) next bar market ;
{ Long Entry Conditions - Oscillating }
Condition21 = VZO crosses above 15 ;
Condition30 = ADXTrending = false and 
( Condition2 or Condition21 ) ;
if Condition30 then
Buy ( "Osc LE" ) next bar market ;
{ Short Entry Conditions - Oscillating }
Condition31 = VZO crosses below -5 ;
Condition40 = ADXTrending = false and
( Condition12 or Condition31 ) ;
if Condition40 then
SellShort ( "Osc SE" ) next bar market ;
{------------------------------------------------
EXITS
-------------------------------------------------}
{ Long Exits - Trending }
if ADXTrending then
if ( VZO > 60 and VZO < VZOMaxHigh ) or
VZO crosses below 60 then
Sell ("VZO Rev Trend LX" ) next bar market ;
{ Divergence Exit }
if ADXTrending and CurrentBar > 50 and BearishDiv and 
VZO crosses below 40 then
Sell ( "Div LX" ) next bar market ;
if ADXTrending and C < EMA and VZO < 0 then
Sell ( "Below EMA/0 LX" ) next bar market ;
{ Short Exits - Trending }
if ADXTrending then
if ( VZO < -60 and VZO > VZOMinLow ) or
VZO crosses above -60 then
BuyToCover ( "VZO Rev Trend SX" ) next bar market ;
{ Divergence Exit }
if ADXTrending and CurrentBar > 50 and BullishDiv 
and VZO crosses above -40 then
BuyToCover ( "Div SX" ) next bar market ;
if ADXTrending and C > EMA and VZO > 0 then
BuyToCover ( "Above EMA/0 SX" ) next bar market ;
{ Long Exits - Oscillating }
if ADXTrending = false then
if ( VZO > 40 and VZO < VZOMaxHigh ) or
VZO crosses below 40 then
Sell ("VZO Rev Osc LX" ) next bar market ;
if ADXTrending = false and VZO crosses below -5 then
Sell ( "Osc LX" ) next bar market ;
{ Short Exits - Oscillating }
if ADXTrending = false then
if ( VZO < -40 and VZO > VZOMinLow ) or
VZO crosses above -40 then
BuyToCover ( "VZO Rev Osc SX" ) next bar market ;
if ADXTrending = false and VZO crosses above 15 then
BuyToCover ( "Osc SX" ) next bar market ;
Condition4 = false ;
Condition14 = false ;

This article is for informational purposes. No type of trading or investment recommendation, advice, or strategy is being made, given, or in any manner provided by TradeStation Securities or its affiliates.

—Chris Imhof, TradeStation Securities, Inc.
A subsidiary of TradeStation Group, Inc.
www.TradeStation.com


To read the entire issue click here and subscribe today!

PTSK — The Professional Traders' Starter Kit
Home| Working Money Magazine | S&C Magazine | Traders.com Advantage | Online Store | Traders’ Resource
Add a Product to Traders’ Resource | Message Boards | Subscribe/Renew | Free Trial Issue | Article Code | Search

DEPARTMENTS: Advertising | Editorial | Circulation | Employment | Contact Us | BY PHONE: (206) 938-0570

Join us on Facebook     Follow us on Twitter     Follow Us on StockTwits

Bookmark and ShareCopyright © 1996-2013 Technical Analysis, Inc. All rights reserved. Read our disclaimer & privacy statement.

SUBSCRIBE TO OUR FREE
EMAIL NEWSLETTER!