Schwager Volatility Ratio Amibroker AFL code and Analysis

by

What is Volatility ratio?

The Term Volatility ratio is coined by Jack D. Schwager to identify trading range and potential trend reversal. The values of the volatility ratio range from 0.01-1.00 and typically traders predicts the reversal points if the value shows above 0.5. However marketcalls recommend to look for reversal above 0.6.

Volatility ratio formula

Volatility Ratio (VR) = Today’s True Range/True Range over N number of days

To calculate the volatility ratio, the true range is calculated using the following formula:

Today’s True Range = MAX (today’s high, yesterday’s close) – MIN (today’s low, yesterday’s close)
and

True Range over N number of days= MAX (Day1 High, Day 2 High, …Day N High, Day 0 Close) minus MIN(Day1 Low, Day 2 Low, …Day N Low, Day 0 Close)

Volatility ratio – Amibroker AFL code

The above code has been derived from the following metastock code as shown below

Builing a Trading System using Volatility Ratio

Now to understand the predictive nature of Volaitity Ratio in idenfitying price reversal we built a simple trading system

The concept is to Buy when Volatility ratio is greater than 0.6 and the past 5 days returns are negative and on the reverse short if the Volatility ratio is greater than 0.6 and the past 5 days returns are positive. And now exit after 10 days of holding the instrument.

We tested the trading system with our benchmark index Nifty on the Daily timeframe. Here is the results about the predictive nature of the indicator followed by snapshots of the signals when volatility ratio crosses 0.6 with period =13

Parameters
Results
Tested SymbolNSENIFTY
Total Number of Trades52
Holding Period10 Days
Winning Trades32
Winning Ratio 61.54%
Points Earned2000 Nifty points
Testing Period1991-2012 (23 years)

Charts below the buy and sell indications for the past 5 years when the volatility ratio shoots above 0.6

Nifty Daily Chart – 2007
Nifty 2007

Nifty Daily Chart – 2008
Nifty 2008

Nifty Daily Chart – 2009
Nifty 2009

Nifty Daily Chart – 2010
Nifty 2010

Nifty Daily Chart – 2011
Nifty 2011

Nifty Daily Chart – 2012
No signals during the year 2012 and 2013

Hope the above article gives your more understanding about the nature of volatility ratio. Test the indicator and provide your feedback here. Your feedback is much are appreciated

Related Readings and Observations

  • RSI Divergence Indicator – Optimized AFL code
    RSI Divergence Indicator - Hope most of them had heard it. Does anyone tested the accuracy of this trading indicator. This RSI Divergence is the modified and optimized version for Nifty and its goo...
  • Download Camarilla AFL code for Amibroker
    Camarilla AFL code for amibroker is posted here as per request from one of the regular member of marketcalls (Mr.Veer). Camarilla AFL code in mainly used by intraday traders and it is used as an a...
  • Larry Connors RSI Amibroker AFL code
    ConnorsRSI is a composite indicator consisting of three components. Two of the three components utilize the Relative Strength Index (RSI) calculations developed by Welles Wilder in the 1970’s, and...
  • Marketcalls – Counter Trend Reversal System
    Here is a simple afl code, which finds the near bottom most of time and can be trade for reversal with mimimal stop loss. Trading system suits EOD timeframe and delivery based buying. Exit signals ...
Rajandran R

Rajandran is a trading strategy designer and founder of Marketcalls, a hugely popular trading site since 2007 and one of the most intelligent blog in the world to share knowledge on Technical Analysis, Trading systems & Trading strategies. More From Rajandran R »

6 comments… add one

  • alrby3ee February 18, 2013 at 4:26 am edit

    Amazing ..thanks Rajandran R

    Reply
  • kumar March 5, 2013 at 10:30 am edit

    nice

    Reply
  • Dick April 12, 2013 at 6:07 am edit

    I found this RSI most interesting but noted no Buy/Sell arrows so added (see below). They should work but don’t so any help will be appreciated.
    Dick
    Note: send correction to me @ areehoi@yahoo.com
    Thanks

    SECTION_BEGIN(“Volatility”);
    //{Volatility Ratio – Schwager}
    //Coded By Rajandran R – http://www.marketcalls.in
    //Date – 18 Feb 2012
    /*The concept is to Buy when Volatility ratio is greater than 0.6 and the past 5 days returns are negative and on the reverse short if the Volatility
    ratio is greater than 0.6 and the past 5 days returns are positive. And now exit after 10 days of holding the instrument.*/

    n=Param(“Periods”,13,1,300,1);
    VRT=Param(“VRthreshold”,0.6,0.5,1,0.1);
    Dday =Param(“Decision Day Based on Prev day returns”,4,3,5,1);
    zero=10^-10;

    r1=H-L;
    r2=abs(H-Ref(C,-1));
    r3=abs(Ref(C,-1)-L);

    TrueRange=Max(Max(r1,r2),r3);

    TrueHighPds=Max(HHV(H,n),Ref(C,-n));
    TrueLowPds=Min(LLV(L,n),Ref(C,-n));
    TrueRangePds=TrueHighPds-TrueLowPds;

    VolatilityRatio=TrueRange/Max(TrueRangePds,zero);

    SetPositionSize(1,spsShares);

    decisionSell=HHV(C,5)-C;
    decisionBuy=C-LLV(C,5);

    Buy =decisionBuy>0 AND Cross(VolatilityRatio,VRT);
    //Sell =0;
    Sell =decisionSell>0 AND Cross(VolatilityRatio,VRT);
    Cover=0;
    //Plot( Buy, “Buy”, colorBlack, styleLine );

    HLine = Param( “Upper Line” ,0.6, 60,95, 5);
    LLine = Param( “Lower Line”,0.2, 5, 40, 5);
    Plot( Lline, “0.6″, colorBrown,styleLine|styleDashed );
    Plot( Hline, “0.2″, colorBrown,styleLine|styleDashed );

    Plot(VolatilityRatio,”Volatility Ratio – Schwager”,colorRed,styleThick);
    shape = Buy * shapeHollowUpArrow + Sell * shapeHollowDownArrow;
    PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBrightGreen,0,L,-15);
    PlotShapes(IIf(Buy,shapeHollowUpArrow,shapeNone),colorBrightGreen,0,L,-15);

    PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
    PlotShapes(IIf(Sell,shapeHollowDownArrow,shapeNone),colorRed,0,H,-15);

    _SECTION_END ();

    Reply
  • srinivas murthy April 25, 2013 (4 weeks ago) at 10:40 pm edit

    thanks for ur valuable effort ,plse guide me how to copy into ami charts the above afl code

    Reply
  • keshav May 1, 2013 (3 weeks ago) at 12:26 pm edit

    its definitely going to generate a lot of short signals than the long ones.

    Reply

Leave a Comment

Recommend on Google