Help for moving average negative bar problem.

 

Hi friends, i have moving average 20 period. I want the have data of 5 period before but couldnt get the value. 

Are there any solution?


//" -5 " seen on chart as a visual but EA doesnt see any value :(


double ma20_5 () 
   { double ma20_5= iMA(_Symbol,_Period,20,-5,MODE_EMA,PRICE_MEDIAN,0); 
   return ma20_5;
   }
 

Your EA is shifted 5 bars backwards, so there is no MA value at Bar[0].

Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

 
Keith Watford:

Your EA is shifted 5 bars backwards, so there is no MA value at Bar[0].

Topics concerning MT4 and MQL4 have their own section.

In future please post in the correct section.

I have moved your topic to the MQL4 and Metatrader 4 section.

Thank you Mr. Watford.