Expert advisor Parabolic SAR

Francesco Martinelli  

Hi all 

i'd like to code an expert advistor in mql5 for the Parabolic SAR indicator that give the same results of the default indicator availble on metatrader 5 menu'.

I coded using this examples https://www.youtube.com/watch?v=UiIOHeewo5k&t=267s.

That version works quite good but when the SAR trend switch the first green dot diverge from the calculated value.

This is the code (called on ontick function)


   double mySARArray[];

   isar =iSAR(trdsymbl,period,0.02,0.2);

   ArraySetAsSeries(mySARArray,true);

   CopyBuffer(isar,0,0,3,mySARArray);

   double psar=NormalizeDouble(mySARArray[1],5);   

   Comment("PSARValue ",psar);


attached on this message the picture where the error is visible 

MQL5 Tutorial - Simple SAR Expert Advisor with MQL5
MQL5 Tutorial - Simple SAR Expert Advisor with MQL5
  • 2017.02.13
  • www.youtube.com
https://mql5tutorial.com/?s=sarWith MQL5 for Metatrader5 you can calculate the SAR Indicator for your Expert Advisor by using the function iSAR with a few li...
File:
psar_error.jpg  351 kb
Motivazione: