AFL code for EMA crossover

Discussion in 'AmiBroker' started by tangotaurian, Jan 2, 2010.

  1. tangotaurian

    tangotaurian Member

    Joined:
    Mar 6, 2008
    Messages:
    30
    Likes Received:
    9
    Trophy Points:
    8
    Hello,
    I am using one AFL code for EMA crossover on EOD charts, Its working fine on EOD, but not on Intraday charts, I want to use it on Intraday charts. I tried to make changes but not succeed.

    Please find below mentioned AFL:-

    x = EMA(Close,5);
    y = EMA(Close,13);

    Buy=Cross(x,y);
    PlotShapes(shapeUpArrow*Buy,colorGreen);
    Sell=Cross(y,x);
    PlotShapes(shapeDownArrow*Sell,colorRed);
    Plot(EMA(Close,5),"",colorBrightGreen,styleLine);
    Plot(EMA(Close,13),"",colorRed,styleLine);
    AlertIf( Buy, "SOUND C:\\Windows\\Media\\notify.wav", "Audio alert", 2 );
    AlertIf( Sell, "SOUND C:\\Windows\\Media\\chord.wav", "Audio alert", 2 );
    XR=(EMA(Close,5) * (2 / 6 - 1) - EMA(Close,13) * (2 / 11 - 1)) / (2 / 6 - 2 / 11);
    Title = Name() + " " + Date()+" " + EncodeColor( colorBlue ) +"5/13 EMA " +EncodeColor( colorBlack )
    + " O " + O + " H " + H + " L " + L + " C "+ C + "\n";


    Kindly modify this AFL to use it on Intraday charts.

    Regards,
    TT
     
  2. vinodkiyer

    vinodkiyer Well-Known Member

    Joined:
    Feb 2, 2009
    Messages:
    352
    Likes Received:
    418
    Trophy Points:
    63
    its working fine on intraday chart. nothing wrong with afl. see if your database settings and intraday settings in preferences is correct or not
     
  3. tangotaurian

    tangotaurian Member

    Joined:
    Mar 6, 2008
    Messages:
    30
    Likes Received:
    9
    Trophy Points:
    8
    @vinodkiyer-yes, if u watch a single script of any time frame its showin right signals. But when u select this AFL through Automatic Analyser & click on Scan, its giving result for EOD chart. I want to scan different time frames(i.e. 5mins, 15mins, 60mins) on intraday, which will give me a result of intraday time frames. I guess da code is not developed for intraday but for EOD. One need to alter da code to work for intrday time frames.
    Somebody please look into da issue.

    Regards,
    TT
     
  4. singhboy

    singhboy Active Member

    Joined:
    Mar 7, 2009
    Messages:
    192
    Likes Received:
    75
    Trophy Points:
    28
    analysis-automatic analysis-settings-general-periodicity, select ur time period on which u want to scan
     
  5. sahil79

    sahil79 Active Member

    Joined:
    Oct 26, 2009
    Messages:
    183
    Likes Received:
    71
    Trophy Points:
    28
    bhai aap kaun sa ver amibroker use karte ho?
     
  6. vinodkiyer

    vinodkiyer Well-Known Member

    Joined:
    Feb 2, 2009
    Messages:
    352
    Likes Received:
    418
    Trophy Points:
    63
    U must do what Singhboy suggested every time u want to scan on a different periiodicity.

    also add the following to the code as the last line:

    Filter = Buy || Sell;
     

  7. singhboy

    singhboy Active Member

    Joined:
    Mar 7, 2009
    Messages:
    192
    Likes Received:
    75
    Trophy Points:
    28
    Filter=(Volume>50000) AND (Buy OR Sell) AND (Close>100);
    AddColumn(Close,"Close",1.4);
    AddColumn(Buy,"buy",1.2);
    AddColumn(Sell,"sell",1.2);
    add this at end of AFL to scan, u can edit volume n price conditions wateva u want
     
  8. tangotaurian

    tangotaurian Member

    Joined:
    Mar 6, 2008
    Messages:
    30
    Likes Received:
    9
    Trophy Points:
    8
    @singhboy-thnx a lot for your help. Now I can get signals for different different periiodicity. Even I`ve added a code for volume n price conditions n testing it now.

    @vinodkiyer-thnx a lot for your help also. I`ve added a code, i guess its for filterin buy/sell...right???

    M still learning AFL. M a slow learner. :-(

    Regards,
    TT
     
  9. vinodkiyer

    vinodkiyer Well-Known Member

    Joined:
    Feb 2, 2009
    Messages:
    352
    Likes Received:
    418
    Trophy Points:
    63
    use Singhboy's code above instead of mine then u can explore also
     
  10. hawaisanjay

    hawaisanjay Active Member

    Joined:
    Aug 17, 2009
    Messages:
    286
    Likes Received:
    223
    Trophy Points:
    43
    Location:
    Mumbai
    Hi!
    Can anybody suggest me AFL for following conditions...
    TIME FRAME-ANY
    EMA - 10,25,50
    BUY- 10EMA CROSS FROM BELOW 25 & 50 EMA
    EXIT- 25EMA CROSS FROM ABOVE 50 EMA
    SELL- 10EMA CROSS FROM ABOVE 25 & 50 EMA
    EXIT- 25EMA CROSS FROM BELOW 50 EMA
    Thanks...
     
Loading...

Share This Page