Trading the Volatility Bands

Discussion in 'AmiBroker' started by abualfoooz, Jul 2, 2010.

  1. abualfoooz

    abualfoooz New Member

    Joined:
    Jun 15, 2010
    Messages:
    16
    Likes Received:
    10
    Trophy Points:
    3
    Trading the Volatility Bands

    if you have it , please share it

    [​IMG]
     
  2. biyasc

    biyasc Well-Known Member

    Joined:
    Apr 13, 2007
    Messages:
    1,167
    Likes Received:
    263
    Trophy Points:
    83
    Location:
    India, West Bengal, Kolkata
    this band looks like a fixed set of horizontal lines. volatility band should be like one which changes according to chage on the stock prices. or i am missing something??:confused:
     
  3. abualfoooz

    abualfoooz New Member

    Joined:
    Jun 15, 2010
    Messages:
    16
    Likes Received:
    10
    Trophy Points:
    3
    You must have come across trading strategies based on Daily pivot and variations like the camarilla pivots.

    Here is a strategy to trade on the statistical levels of volatility. The volatility values for a particular day are calculated. Based on these volatility values bands are calculated for different standard deviations 0.25, 0.5, 1.0, 1.28, 1.5, 2.0, 2.5

    This is based on the assumption that volatility reverts to the mean and the price also seeks a equilibrium value. As per statistics the probability of the price being contained within a certain standard deviation band is as follow.

    STDDEV PROBABILITY
    1.00 68%
    1.28 80%
    1.50 88%
    2.00 95%

    You will observe that the prices tend to reverse at the extremes of these bands. The probability of a price reversal at the one standard deviation band is 68% and the probability of reversal at the 1.28 bands is 80% and so on. These probability bands provide a good method for intraday traders.

    One can go long when the price crosses a particular band keeping the band value itself as a stop loss. When the price crosses the next band raise the stop loss thereby locking the profit. When the price stalls at a particular band unable to cross it is time to close your position and be ready to go on the reverse trade.

    This strategy based on the volatility bands provides good high probability trades.
     
    jagankris and columbus like this.
  4. abualfoooz

    abualfoooz New Member

    Joined:
    Jun 15, 2010
    Messages:
    16
    Likes Received:
    10
    Trophy Points:
    3
    up >>>>> plz
     
  5. jagankris

    jagankris Well-Known Member

    Joined:
    Mar 24, 2010
    Messages:
    1,523
    Likes Received:
    3,416
    Trophy Points:
    113
    Location:
    India
    I think the bands are created based on the average Volatility of past few days and not the intraday volatality.

    Pls share the AFL.

    TIA.
     
  6. Bonkers

    Bonkers New Member

    Joined:
    Jan 9, 2010
    Messages:
    14
    Likes Received:
    20
    Trophy Points:
    3
    Here you go

    --- Begin cut ---

    /*
    You must have come across trading strategies based on Daily pivot and variations like the camarilla pivots.

    Here is a strategy to trade on the statistical levels of volatility. The volatility values for a particular
    day are calculated. Based on these volatility values bands are calculated for different standard deviations
    0.25, 0.5, 1.0, 1.28, 1.5, 2.0, 2.5

    This is based on the assumption that volatility reverts to the mean and the price also seeks a equilibrium
    value. As per statistics the probability of the price being contained within a certain standard deviation
    band is as follow.

    STDDEV PROBABILITY
    1.00 – 68%
    1.28 – 80%
    1.50 – 88%
    2.00 – 95%

    You will observe that the prices tend to reverse at the extremes of these bands. The probability of a price
    reversal at the one standard deviation band is 68% and the probability of reversal at the 1.28 bands is 80%
    and so on. These probability bands provide a good method for intraday traders.

    One can go long when the price crosses a particular band keeping the band value itself as a stop loss. When
    the price crosses the next band raise the stop loss thereby locking the profit. When the price stalls at a
    particular band unable to cross it is time to close your position and be ready to go on the reverse trade.

    This strategy based on the volatility bands provides good high probability trades.
    */
    _SECTION_BEGIN("Volatility Bands V.1.0");
    SetChartOptions(0,chartShowArrows|chartShowDates);
    gxs=Param("GRAPH spaceing",10,5,50,5);
    GraphXSpace = gxs;
    SetChartBkColor(ParamColor("Outer panel color ",colorGrey50));
    SetChartBkGradientFill( ParamColor("Inner panel color upper half",colorGrey40),
    ParamColor("Inner panel color lower half",colorDarkOliveGreen));

    Periods = Param("Periods", 10, 2, 100, 1 );

    VFH=Param("YH",0.01571,-0.1,0.10,0.00001);
    VFL=Param("YL",0.01361,-0.1,0.10,0.00001);

    P1 = TimeFrameGetPrice( "C", inDaily, -1 );
    T1a = P1+(P1*0.5*VfH);
    T1b = P1+(P1*0.5*VfL);
    B1a = P1-(P1*0.5*VfH);
    B1b = P1-(P1*0.5*VfL);

    T2a = P1+(P1*1*VfH);
    T2b = P1+(P1*1*VfL);
    B2a = P1-(P1*1*VfH);
    B2b = P1-(P1*1*VfL);

    T3 = P1+(P1*1.28*VfH);
    B3 = P1-(P1*1.28*VfL);

    T4 = P1+(P1*1.5*VfH);
    B4 = P1-(P1*1.5*VfL);

    T5 = P1+(P1*2*VfH);
    B5 = P1-(P1*2*VfL);

    T6 = P1+(P1*2.5*VfH);
    B6 = P1-(P1*2.5*VfL);

    T7 = P1+(P1*3*VfH);
    B7 = P1-(P1*3*VfL);

    T8a = P1+(P1*0.25*VfH);
    T8b = P1+(P1*0.25*VfL);
    B8a = P1-(P1*0.25*VfH);
    B8b = P1-(P1*0.25*VfL);

    Cb=ParamToggle("0.25 ","NO|YES" ,0);
    Cb1=ParamToggle("0.50 ","NO|YES" ,0);
    Cb2=ParamToggle("1.0 ","NO|YES" ,0);
    Cb3=ParamToggle("1.28 ","NO|YES" ,1);
    Cb4=ParamToggle("1.50 ","NO|YES" ,0);
    Cb5=ParamToggle("2.0 ","NO|YES" ,0);
    Cb6=ParamToggle("2.50 ","NO|YES" ,0);
    Cb7=ParamToggle("Alerts","NO|YES" ,1);
    if(Cb==1){
    Plot( T8A,"",colorYellow, 32|styleNoLabel );
    Plot( B8A,"",colorYellow, 32|styleNoLabel );
    }if(Cb1==1){
    Plot( T1a,"",3, 32|styleNoLabel );
    Plot( B1a,"",3, 32|styleNoLabel );
    }if(Cb2==1){
    Plot( T2a,"", colorOrange, 4|styleNoLabel );
    Plot( B2a,"", colorOrange, 4|styleNoLabel );
    }if(Cb3==1){
    Plot( T3,"",colorGreen, 32|styleNoLabel );
    Plot( B3,"",colorGreen, 32 |styleNoLabel);
    }if(Cb4==1){
    Plot( T4,"", colorLime, 1|styleNoLabel );
    Plot( B4,"", colorLime, 1|styleNoLabel );
    }if(Cb5==1){
    Plot( T5,"", colorOrange, 32|styleNoLabel );
    Plot( B5,"", colorOrange, 32|styleNoLabel );
    }if(Cb6==1){
    Plot( T6,"", colorLightOrange, 1|styleNoLabel );
    Plot( B6,"", colorLightOrange, 1|styleNoLabel );
    }
    HaClose=C ;
    Plot(C,"",47,64);
    PlotOHLC( Null, t1a, t1b, Null, "", colorGrey40, styleCloud);
    PlotOHLC( Null, b1a, b1b, Null, "", colorGrey40, styleCloud);
    PlotOHLC( Null, t8a, t8b, Null, "", colorLightYellow, styleCloud);
    PlotOHLC( Null, b8a, b8b, Null, "", colorLightYellow, styleCloud);
    PlotOHLC( Null, t2a, t2b, Null, "", colorTan, styleCloud);
    PlotOHLC( Null, b2a, b2b, Null, "", colorTan, styleCloud);

    up=(Cross(HaClose,t8a)OR Cross(HaClose,t1a)OR Cross(HaClose,t2a) OR Cross(HaClose,t3)OR Cross(HaClose,t4)OR Cross(HaClose,t5))
    OR Cross(Haclose,b8b) OR Cross(Haclose,b1b) OR Cross(Haclose,b2b) OR Cross(Haclose,b3) OR Cross(Haclose,b4) OR Cross(Haclose,b5);
    dn=Cross(b8a,HaClose)OR Cross( b1a,HaClose)OR Cross( b2a,HaClose)OR Cross(b3,HaClose)OR Cross( b4,HaClose)OR Cross( b5,HaClose)
    OR Cross(t8b,HaClose)OR Cross( t1b,HaClose)OR Cross( t2b,HaClose)OR Cross(t3,HaClose)OR Cross( t4,HaClose)OR Cross( t5,HaClose);

    //up=ExRem(up,dn);
    //dn=ExRem(dn,up);

    if(Cb7==1){
    PlotShapes( IIf( up, shapeUpArrow, shapeNone ),10,0,L,-10 );
    PlotShapes( IIf( dn, shapeDownArrow, shapeNone ),13,0,H,-10 );}

    C13=Param("fonts",20,10,30,1 );
    C14=Param("left-right",2.1,1.0,5.0,0.1 );
    C15=Param("up-down",7,1,10,1 );
    Version( 5.04 ); // requires 5.04 or higher
    GfxSetOverlayMode( 0 );
    CellHeight = 18;
    CellWidth = 50;
    GfxSelectFont( "Tahoma", CellHeight/2 );
    GfxSetBkColor(colorGold) ;
    GfxSetBkMode( 2 ) ;
    function PrintInCell( string, row, Col )
    {
    GfxDrawText( string, Col * CellWidth, row * CellHeight, (Col + 1 ) * CellWidth, (row + 1 ) * CellHeight, 0 );
    }
    PrintInCell( " +2.5 ", 0, 0 );
    PrintInCell( " +2.0 ", 0, 1 );
    PrintInCell( " +1.5 ", 0, 2 );
    PrintInCell( " +1.0 ", 0, 3 );
    PrintInCell( " +0.50 ", 0, 4 );
    PrintInCell( " +0.25 ", 0, 5 );
    PrintInCell( " -0.25 ", 0, 7 );
    PrintInCell( " -0.50 ", 0, 8 );
    PrintInCell( " -1.0 ", 0, 9 );
    PrintInCell( " -1.50 ", 0, 10 );
    PrintInCell( " -2.0 ", 0, 11 );
    PrintInCell( " -2.5 ", 0, 12 );
    GfxSelectPen( colorRed );
    for( i = 1; i < 2 && i < BarCount; i++ )
    {
    GfxSetBkColor(27);
    PrintInCell( StrFormat(" %g ", LastValue(t6) ), i, 0 );
    PrintInCell( StrFormat(" %g ", LastValue(t5) ), i, 1 );
    PrintInCell( StrFormat(" %g ", LastValue(t4) ), i, 2 );
    PrintInCell( StrFormat(" %g ", LastValue(t2a) ), i, 3 );
    PrintInCell( StrFormat(" %g ", LastValue(t1a) ), i, 4 );
    PrintInCell( StrFormat(" %g ", LastValue(t8a) ), i, 5 );
    GfxSetBkColor(33);
    PrintInCell( StrFormat(" %g ", LastValue(b8a) ), i, 7 );
    PrintInCell( StrFormat(" %g ", LastValue(b1a) ), i, 8 );
    PrintInCell( StrFormat(" %g ", LastValue(b2a) ), i, 9 );
    PrintInCell( StrFormat(" %g ", LastValue(b4) ), i, 10 );
    PrintInCell( StrFormat(" %g ", LastValue(b5) ), i, 11 );
    PrintInCell( StrFormat(" %g ", LastValue(b6) ), i, 12 );
    GfxMoveTo( 0, i * CellHeight );
    GfxLineTo( 13 * CellWidth, i * CellHeight );
    }
    GfxMoveTo( 0, i * CellHeight );
    GfxLineTo( 13 * CellWidth, i * CellHeight );
    for( Col = 0; Col < 14; Col++ )
    {
    GfxMoveTo( Col * CellWidth, 0);
    GfxLineTo( Col * CellWidth, 2 * CellHeight );
    }

    pxwidth = Status("pxwidth");
    pxheight = Status("pxheight");
    GfxSetBkMode( 0);
    GfxSelectFont("Tahoma", Status("pxheight")/C13 );
    GfxSetTextAlign( 6 );
    GfxSetTextColor( 47 );

    GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
    GfxTextOut( "Vol-Bands", Status("pxwidth")/C14, Status("pxheight")/C15*2.5 );
    GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
    Title =EncodeColor(colorWhite)+ "" + " +\n\n\n " + Name() + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
    " - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
    "Cl-"+C+" "+ "Vol= "+ WriteVal(V);
    NewDay = Day() != Ref( Day(), -1 );
    Plot( NewDay, "", 31, styleDashed | styleOwnScale | styleNoLabel | styleLine | styleHistogram );
    _SECTION_END();

    --- End cut ---

    Regards
     
    ahmad7897, jagankris and dishant4u like this.

  7. abualfoooz

    abualfoooz New Member

    Joined:
    Jun 15, 2010
    Messages:
    16
    Likes Received:
    10
    Trophy Points:
    3
    Bonkers

    thank you
     
  8. worldastro

    worldastro Active Member

    Joined:
    Jun 2, 2008
    Messages:
    240
    Likes Received:
    42
    Trophy Points:
    28
    it is too much bye sell signal !!!!!!!
     
  9. ananthsankaran

    ananthsankaran New Member

    Joined:
    Apr 3, 2009
    Messages:
    29
    Likes Received:
    24
    Trophy Points:
    3

    REQUESTING YOU TO HAVE SOME CREDIT FOR THE ORIGINAL CREATOR OF THIS AFL - KARTHIK MARAR.... Wonder how you people happy choose to hide the name and share just the AFLs alone..

    its only bcoz of these cheap acts, legends like saint, Karthik, Ashish da have moved out...

    grow up kids/guys.......... nobody is asking you not to share... first do a self study... dont expect to have fast food all the time.........

    a full course meal will always lead you to a healthy life....... and not fast food...
     
    rvlv and karthikmarar like this.
  10. karthikmarar

    karthikmarar Well-Known Member

    Joined:
    Jul 3, 2005
    Messages:
    1,527
    Likes Received:
    1,140
    Trophy Points:
    113
    Location:
    kuwait
Loading...

Share This Page