Download MetaTrader 5

Question from a MQL4 Newbie

To add comments, please log in or register
BigDub
22
BigDub  

Hi All,

I‌ recently started writing indicators using MQL4, and I could not solve the issues that I faced in the mq4 file attached. In this simple testing file, I wish to copy my MACD array to the Short Array, but it seems that the Short Array does not store any data successfully.

H‌ope someone could kindly offer his/her help.

‌Thanks.

Files:
whroeder1
17124
whroeder1  
If you added #property strict you would know that the two EMAs, MACD and Signal have no size and therefor no values.
double MACD[];
int start(){
   double EMA_12[], EMA_26[];
   double Signal[];
:
   for(int i=limit-1; i>=0; i--){
      EMA_12[i] = ...
      EMA_26[i] = ...
      MACD[i]= EMA_12[i]-EMA_26[i];

      Signal[i] = alpha_9_1*MACD[i] + alpha_9*Signal[i+1];
BigDub
22
BigDub  
whroeder1:
If you added #property strict you would know that the two EMAs, MACD and Signal have no size and therefor no values.
double MACD[];
int start(){
   double EMA_12[], EMA_26[];
   double Signal[];
:
   for(int i=limit-1; i>=0; i--){
      EMA_12[i] = ...
      EMA_26[i] = ...
      MACD[i]= EMA_12[i]-EMA_26[i];

      Signal[i] = alpha_9_1*MACD[i] + alpha_9*Signal[i+1];


Thanks very much for the reply.

I do not quite understand this. Do you suggest to put all definitions of these arrays to the top where Long and Short are defined? I tried so, and it still does not work.

Although EMA_12, EMA_26 and Signal have no size at beginning, didn't I add values into these arrays in my loop function?

BigDub
22
BigDub  
Can someone help please.
To add comments, please log in or register