MQL4 - automated forex trading   /  

Forum

Use the MA from the chart

Back to topics list To post a new topic, please log in or register

avatar
21
Ryan 2007.11.12 02:50 
I am trying to get a variable for a 50 minute simple moving average, the one that appears on the chart when I apply it to one. I am using:

double MoveA = iMA(NULL,PERIOD_M1,50,0,MODE_SMMA,PRICE_MEDIAN,0);

When I use the print function to print out MoveA, it is never very far away from the current quote. That is, it doesn't seem to be the moving average that appears on the chart.
article

Transferring an Indicator Code into an Expert Advisor Code. Conclusion

This is the final article, devoted to transferring an indicator code into an Expert Advisor code. Here the author transforms on a certain example a code of an Expert Advisor so, that this EA is presented in a single file without calling custom indicators.


avatar
31
faqcya 2007.11.15 03:55 

well for starters do you want the simple moving average or the smoothed moving average? simple moving average is SMA smoothed moving average is the SMMA. Secondly the moving average is usually computed at the close unless you want the median use the following

double MoveA = iMA(NULL,1,50,0,MODE_SMA,PRICE_CLOSE,0);

Back to topics list  

To add comments, please log in or register