Thank you, I will try this code to draw the lines, and I did check the code, its all exactly the same, I even tried the iMA function- as below (Please check the code and kindly guide me if there is something wrong… because the difference between both Indi and EA MAs are varies and sometimes really huge upto 400 points difference… ex if Indi MA5 value is 1.32300 the EA MA5 prints 1.32700 I’m totally lost and have no clue why… I tried with different forex companies demo accounts, still the same issue
//Indicator
//INIT Function
int shift_begin=int(MathSqrt(period)+period+1);
IndicatorShortName("Name");
SetIndexBuffer(0,MA5);
SetIndexBuffer(1,MA10);
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,shift_begin);
SetIndexDrawBegin(2,shift_begin);
//onCal function
int limit=rates_total-prev_calculated;
if(prev_calculated==0)limit--;
else limit++;
for(i=0; i<limit && !IsStopped(); i++)
MA5[i] = iMA(Symbol(), PERIOD_CURRENT, 5,0, 3, 0,Shift);
for(i=0; i<limit && !IsStopped(); i++)
MA10[i] = iMAOnArray(MA5,0,(int)MathRound(period),0,3,i);
//------------------------------------------------------------------------
//EA Code
//------------------------------------------------------------------------
//Calc MA Function
double MA5[],MA10[];
ArraySetAsSeries(MA5,true);
ArraySetAsSeries(MA10,true);
max=1000;
ArrayResize(MA5,max);
ArrayResize(MA10,max);
for(int i=max-1; i>=0; i--)
MA5[i] = iMA(Symbol(), PERIOD_CURRENT, 5, 0, 3, 0,Shift);
for(int i=max-1; i>=0; i--)
MA10[i] = NormalizeDouble(iMAOnArray(MA5,0,(int)MathRound(period),0,3,i),_Digits);