I Need Help For Creating A Exploration Of An Amibroker AFL

Discussion in 'Trading Software' started by Samrat Saha, Apr 30, 2016.

  1. I Need Help For Creating A Exploration Of An Amibroker AFL, The Afl Is As Below:

    _SECTION_BEGIN("Price");
    SetChartOptions(0,chartShowArrows|chartShowDates);
    _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
    //Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );



    tchoice=Param("Title Selection ",2,1,2,1);

    Q=Param("% Change",2.1,1,10,1);
    Z= Zig(C ,q ) ;
    HH=((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(z,q,1 ) >Peak(Z,q,2)));
    LH=((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(Z,q,1 ) <Peak(Z,q,2)));
    HL=((Z>Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2)) AND (Trough(Z,q,1 ) >Trough(Z,q,2)));
    LL=((Z>Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2)) AND (Trough(Z,q,1 ) <Trough(Z,q,2)));
    GraphXSpace = 5;
    dist = 0.5*ATR(20);

    for( i = 0; i < BarCount; i++ )
    {
    if( HH ) PlotText( "HH \n"+H, i, H[ i ]+dist, colorCustom12 );
    if( LH ) PlotText( "LH: Sell \n @ "+H, i, H[ i ]+dist, colorCustom12 );
    if( HL ) PlotText( "HL:buy \n @"+L, i, L[ i ]-dist, colorAqua );
    if( LL ) PlotText( "LL\n"+L, i, L[ i ]-dist, colorAqua );

    }
    TimeFrameSet(inDaily);
    MA3 = MA(C,3);
    Cl = C;
    TimeFrameRestore();
    MA3=(TimeFrameExpand( MA3, inDaily));
    Cl=(TimeFrameExpand( Cl, inDaily));
    barcolor =IIf(C > MA3 , colorGreen,IIf(C < MA3,colorRed, colorBlack) );
    Plot( C, "Close", barcolor , styleNoTitle |styleCandle);

    _SECTION_END();

    _SECTION_BEGIN( "Chart Settings");
    SetChartOptions( 0,chartShowArrows|chartShowDates );
    SetChartBkColor( ParamColor( "Outer panel",colorBlack) );
    SetChartBkGradientFill(
    ParamColor(" Inner panel upper",colorDarkGrey),
    ParamColor(" Inner panel lower",colorBlack) );
    numbars = LastValue(Cum( Status("barvisib le")));
    dec = (Param("Decimals" ,2,0,7,1) /10)+1;
    bi=BarIndex( );
    sbi = BarIndex();

    //Plot(C,"",IIf( C>O,27, IIf(C<O,32,colorGrey50)),64) ;
     
  2. gogo246

    gogo246

    Here my first post

    _SECTION_BEGIN("Price");
    SetChartOptions(0,chartShowArrows|chartShowDates);
    _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
    //Plot( C, "Close", ParamColor("Color", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

    tchoice=Param("Title Selection ",2,1,2,1);

    Q=Param("% Change",2.1,1,10,1);
    Z= Zig(C ,q ) ;
    HH=((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(z,q,1 ) >Peak(Z,q,2)));
    LH=((Z<Ref(Z,-1) AND Ref(Z,-1) > Ref(Z,-2)) AND (Peak(Z,q,1 ) <Peak(Z,q,2)));
    HL=((Z>Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2)) AND (Trough(Z,q,1 ) >Trough(Z,q,2)));
    LL=((Z>Ref(Z,-1) AND Ref(Z,-1) < Ref(Z,-2)) AND (Trough(Z,q,1 ) <Trough(Z,q,2)));
    GraphXSpace = 5;
    dist = 0.5*ATR(20);

    for( i = 0; i < BarCount; i++ )
    {
    if( HH ) PlotText( "HH \n"+H, i, H[ i ]+dist, colorCustom12 );
    if( LH ) PlotText( "LH: Sell \n @ "+H, i, H[ i ]+dist, colorCustom12 );
    if( HL ) PlotText( "HL:buy \n @"+L, i, L[ i ]-dist, colorAqua );
    if( LL ) PlotText( "LL\n"+L, i, L[ i ]-dist, colorAqua );

    }
    TimeFrameSet(inDaily);
    MA3 = MA(C,3);
    Cl = C;
    TimeFrameRestore();
    MA3=(TimeFrameExpand( MA3, inDaily));
    Cl=(TimeFrameExpand( Cl, inDaily));
    barcolor =IIf(C > MA3 , colorGreen,IIf(C < MA3,colorRed, colorBlack) );
    Plot( C, "Close", barcolor , styleNoTitle |styleCandle);

    Buy = HL;
    Sell = LH;
    Filter = Buy OR Sell OR LL OR HH;
    AddColumn(IIf(Buy,1,IIf(Sell,-1,0)),"HL/LH",1);
    AddColumn(IIf(LL,1,IIf(HH,-1,0)),"LL/HH",1);

    _SECTION_END();

    //Plot(C,"",IIf( C>O,27, IIf(C<O,32,colorGrey50)),64) ;
     
    Last edited: May 11, 2016