Download MetaTrader 5
To add comments, please log in or register
Publish programs in Code Base. Improve your rating!
remyvi
6
remyvi 2013.11.30 15:47 

I'm building an EA trading in 15 minutes timeframe,However, I want to check the trend in daily MA, so I run the following code to determine the trend.

double ma=iMA(NULL,PERIOD_D1,2,0,MODE_SMA,PRICE_CLOSE,0);

Also, I add a MA indicator in daily chart. However, the value of ma is not equal the value in chart, for example, 2012.1.29, the ma of EURUSD in indicator is 1.3174, the value of EA ma is 1.3096. I don't know why, please help me to fix it.


Ian Flanagan
549
Ian Flanagan 2013.11.30 15:55  

you can get the code used in the MA indicator (google it) and see the difference

seems a bit strange you are finding the trend by averaging over only 2 bars.

Keith Watford
Moderator
9597
Keith Watford 2013.11.30 20:50  
trendflowto:

I'm building an EA trading in 15 minutes timeframe,However, I want to check the trend in daily MA, so I run the following code to determine the trend.

double ma=iMA(NULL,PERIOD_D1,2,0,MODE_SMA,PRICE_CLOSE,0);

Also, I add a MA indicator in daily chart. However, the value of ma is not equal the value in chart, for example, 2012.1.29, the ma of EURUSD in indicator is 1.3174, the value of EA ma is 1.3096. I don't know why, please help me to fix it.



Probably because the settings for the iMA in the EA are not the same as the MA on the chart
/
To add comments, please log in or register