Download MetaTrader 5
To add comments, please log in or register
MQL5 library has more than 1500 apps already. Contribute your own one!
Ernest Klokow
1069
Ernest Klokow 2014.12.11 21:42 

I am writing a simple EA based on Moving Averages but my code returns zero values. It does not make sense to me.

Can somebody help please? Here is the code that returns no values / or zeroes for the variables defined (MAlong, MAmedium and MAshort):

 MAlong = iMA(NULL,0,ShiftLong,PeriodLong,MethodLong,PRICE_CLOSE,0);
 MAmedium = iMA(NULL,0,ShiftMedium,PeriodMedium,MethodMedium,PRICE_CLOSE,0);
 MAshort = iMA(NULL,0,ShiftShort,PeriodShort,MethodShort,PRICE_CLOSE,0);
Carl Schreiber
5938
Carl Schreiber 2014.12.11 22:09  

hmm ??

Do you know there is an iMA-EA-example: Moving Average.mq4  in you expert folder?

What about changing this acc. to your ideas?

Ernest Klokow
1069
Ernest Klokow 2014.12.11 23:51  
gooly:

hmm ??

Do you know there is an iMA-EA-example: Moving Average.mq4  in you expert folder?

What about changing this acc. to your ideas?


I know this EA, but I am taking a complete different approach. Just tell me if there is something wrong with the code. Why am I not getting any values?
whroeder1
13602
whroeder1 2014.12.12 00:19  
ernest02: Just tell me if there is something wrong with the code. Why am I not getting any values?
How should we know? You have nine variables where you don't show their type or value! There are no mind readers here. Why didn't you trap GetLastError()?
Keith Watford
Moderator
7891
Keith Watford 2014.12.12 00:29  
MAlong = iMA(NULL,0,ShiftLong,PeriodLong,MethodLong,PRICE_CLOSE,0);

I would guess should be 

MAlong = iMA(NULL,0,PeriodLong,ShiftLong,MethodLong,PRICE_CLOSE,0);
Ernest Klokow
1069
Ernest Klokow 2014.12.12 07:13  
GumRai:

I would guess should be 

 

GumRai,

THANK YOU VERY MUCH! You were the only one who took some time to check my code and find the error.

I am so very grateful for you taking the time.

/
To add comments, please log in or register