1. Welcome to the international stock forum - forex forum ! Chào mừng đến với diễn đàn quốc tế chứng khoán - forex ! www.Traders.vn
    Dismiss Notice

PRA TTS V1.1 (amibroker code)

Thảo luận trong 'Amibroker' bắt đầu bởi traders, 14/5/17.

  1. traders

    traders Administrator Thành viên BQT

    Tham gia ngày:
    29/4/17
    Bài viết:
    110
    Đã được thích:
    1
    Điểm thành tích:
    18


    amibroker code : PRA TTS V1.1 trong phân tích kỹ thuật chứng khoán, cổ phiếu
    - Chép code sau ( Để tiện theo dõi bài viết mình để code này trong khung cuối bài ) Copy và dán vào Formular editor và lưu lại

    - Chương trình sẽ lưu theo mặc định : Program files\Amibroker\formulas\PRA TTS V1.1 for amibroker cho Amibroker.

    Hình ảnh PRA TTS V1.1 for amibroker



    [​IMG]

    Dưới đây là Code :
    ---------------------------------------------------------------------------------------------------------------------------------------


    AddColumn(Volume,"Volume",1.0, colorDefault, IIf ((Volume > 1.25 * EMA( Volume, 34 )),colorBlue,colorYellow));
    AddColumn( H1, "PRE-HIGH" );

    AddColumn( L1, "PRE-LOW" );

    AddColumn( D1, "PRE-DIFF" );

    AddColumn( F1, "0.433" );

    AddColumn( F2, "0.766" );

    AddColumn( F3, "1.35" );

    AddColumn( H2, "D-HIGH" );

    AddColumn( L2, "D-LOW" );

    AddColumn( D2, "D-DIFF" );

    AddColumn( F4, "SELECT FACT" );

    AlertIf( Buy , "SOUND C:\\Windows\\Media\\chimes.wav", "Audio alert", 2 );
    AlertIf( Sell , "SOUND C:\\Windows\\Media\\alert.wav", "Audio alert", 2 );
    }

    Short=Sell;
    Cover=Buy;
    Long=Flip(Buy,Sell);
    Shrt=Flip(Short,Cover);
    SellPrice=ValueWhen(Short,C,1);
    BuyPrice=ValueWhen(Buy,C,1);
    Edc=(
    WriteIf (Buy AND Ref(shrt,-1), " BUY @ "+C+" ","")+
    WriteIf (Sell AND Ref(Long,-1), " SEll @ "+C+" ","")+
    WriteIf(Sell , "Last Trade Profit Rs."+(C-BuyPrice)+"","")+
    WriteIf(Buy , "Last Trade Profit Rs."+(SellPrice-C)+"",""));

    //============== TITLE ==============



    _SECTION_BEGIN("Tops and bottom");

    pd = Param("Periods",13,5,144,1);
    pds = 2*pd-1;// (Adjustment for Wilders MA)
    aa = Close-Ref(Close,-1);
    uu = EMA(Max(0,aa),pds);
    dd= EMA((Max(0,0-aa)),pds);

    rf = IIf(C>2,1000,10000);

    c1 = Param("Upper Level",70,50,90,1);
    qq1 =100/(100-c1)-1;
    ff1 = qq1*dd-uu;
    ff2 = ff1/qq1;
    f1 = Max(ff1,ff2);
    UL = Close + f1*(pds-1)/2;
    UL = IIf(UL>C,floor(UL*rf),ceil(UL*rf))/rf;

    c2 = Param("Equilibrium",50,50,50,0);
    qq2 =100/(100-c2)-1;// [=1]
    ff = dd-uu;
    MM = Close + ff*(pds-1)/2;
    MM = IIf(MM>C,floor(MM*rf),ceil(MM*rf))/rf;

    c3 = Param("Lower Level",30,10,50,1);
    qq3 =100/(100-c3)-1;
    ff1 = qq3*dd-uu;
    ff2 = ff1/qq3;
    f3 = Min(ff1,ff2);
    LL = Close + f3*(pds-1)/2;
    LL = IIf(LL>C,floor(LL*rf),ceil(LL*rf))/rf;

    band = Param("band width",4,0,15,0.25);
    mmu = MM+band;
    mmd = MM-band;

    _SECTION_BEGIN("Pivot calc");

    TimeFrameSet( in15Minute*2 );
    DH=Ref(H,-1);
    DL=Ref(L,-1);
    DC=Ref(C,-1);


    pd = ( DH+ DL + DC )/3;
    sd1 = (2*pd)-DH;
    sd2 = pd -(DH - DL);
    sd3 = Sd1 - (DH-DL);
    rd1 = (2*pd)-DL;
    rd2 = pd +(DH -DL);
    rd3 = rd1 +(DH-DL);

    if(ChangeTitle==1)
    {

    _SECTION_BEGIN("Title");
    no=Param( "Swing", 6, 1, 55 );
    res=HHV(H,no);
    sup=LLV(L,no);
    avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
    avn=ValueWhen(avd!=0,avd,1);
    tsl=IIf(avn==1,sup,res);
    dec = (Param("Decimals",2,0,7,1)/10)+1;
    if( Status("action") == actionIndicator )
    (
    Title = EncodeColor(55)+ Title = Name() + " " + EncodeColor(32) + Date() +
    " " + EncodeColor(5) + "{{INTERVAL}} " +
    EncodeColor(55)+ " Open = "+ EncodeColor(52)+ WriteVal(O,dec) +
    EncodeColor(55)+ " High = "+ EncodeColor(5) + WriteVal(H,dec) +
    EncodeColor(55)+ " Low = "+ EncodeColor(32)+ WriteVal(L,dec) +
    EncodeColor(55)+ " Close = "+ EncodeColor(52)+ WriteVal(C,dec)+
    EncodeColor(55)+ " Volume = "+ EncodeColor(52)+ WriteVal (V ,1.25)




    +"\n"+EncodeColor(colorBrightGreen)+

    WriteIf (Buy , "Signal: Go Long - Entry Price: "+WriteVal(C)+" - Traget: "+WriteVal((BuyPrice-tsl)+BuyPrice)

    +" - StopLoss:"+WriteVal(tsl)+" "

    ,"")+

    "\n"+EncodeColor(colorRed)+
    WriteIf (Sell , "Signal: Go Short - Entry Price: "+WriteVal(C)+" - Target: "+WriteVal((tsl-SellPrice)-SellPrice)+" - StopLoss:"+WriteVal(tsl)+" ","")+
    EncodeColor(colorTurquoise)+
    WriteIf(Long AND NOT Buy, "Trade: Long - Entry Price: "+WriteVal((BuyPrice))+" - Profit: "+WriteVal((C-BuyPrice))+" "+EncodeColor(colorLime)+"Let your profit runs!","")+
    EncodeColor(colorLightOrange)+
    WriteIf(shrt AND NOT Sell, "Trade: Short - Entry Price: "+WriteVal((SellPrice))+" - Profit: "+WriteVal((C-SellPrice))+" - "+EncodeColor(colorLime)+"Let your profit runs!","")+

    EncodeColor(colorBrightGreen)+ "


    \n R3 : "+
    EncodeColor(colorWhite)+RD3+
    EncodeColor(colorBrightGreen)+ "\n R2 : "+
    EncodeColor(colorWhite)+RD2+
    EncodeColor(colorBrightGreen)+ "\n R1 : " +
    EncodeColor(colorWhite)+RD1 +
    EncodeColor(colorBrightGreen)+ " UP TGT : "+
    EncodeColor(colorWhite)+UL+
    EncodeColor(colorBlue)+ "\n Pivot : "+
    EncodeColor(colorWhite)+pd+
    EncodeColor(colorBlue)+ " MIDPOINT : "+
    EncodeColor(colorWhite)+MM+
    EncodeColor(colorRed)+ "\n S1 : "+
    EncodeColor(colorWhite)+SD1 +
    EncodeColor(colorRed)+ " BOT TGT : "+
    EncodeColor(colorWhite)+LL+
    EncodeColor(colorRed)+ "\n S2 : "+
    EncodeColor(colorWhite)+SD2+
    EncodeColor(colorRed)+ "\n S3 : "+
    EncodeColor(colorWhite)+SD3
    );
    _SECTION_END();
    }

    if(Buyselllable==1)
    {
    dist = 1.5*ATR(10);
    dista = 0.5*ATR(10);
    for( i = 0; i < BarCount; i++ )
    {

    if( Buy ) PlotText( "Buy \n"+C , i, L[ i ]-dist, colorBlack,colorGreen );
    if( Sell ) PlotText( "Sell \n"+C, i, H[ i ]+dist, colorBlack, colorRed );
    //if( Buy ) PlotText( "B" , i, L[ i ]-dist, colorBlack,colorGreen );
    //if( Sell ) PlotText( "S" , i, H[ i ]+dist, colorBlack, colorRed );
    if( Sell ) PlotText( "Top" , i, H[ i ]+dista, colorGreen, colorBlack );
    if( Buy ) PlotText( "Bottom", i, L[ i ]-dista, colorRed, colorBlack );


    } }
     

Chia sẻ trang này

Đang tải...