What's wrong with the iMA()

 

when i tring to get some average data, the iMA return me the incorrect number ! the EA print shows that" JPY 0 0 0 " "CHF 1.5141 1.5141 15.141 (3 same numbers) " ...

It there something wrong with the following codes ? OR MQL4 ?

#property copyright "Copyright ? 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
//+------------------------------------------------------------------+


extern string symbol2 = "EURJYP";
extern string symbol3 = "EURCHF";

double EJ_10,EJ_20,EJ_30, EF_10,EF_20,EF_30;


int init()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{

      EJ_10=iMA("EURJYP",PERIOD_M5,10,0,MODE_SMA,PRICE_WEIGHTED,0);
      EJ_20=iMA("EURJYP",PERIOD_M5,20,0,MODE_SMA,PRICE_WEIGHTED,0);
      EJ_30=iMA("EURJYP",PERIOD_M5,30,0,MODE_SMA,PRICE_WEIGHTED,0); 

      EF_10=iMA("EURCHF",PERIOD_M5,10,0,MODE_SMA,PRICE_WEIGHTED,0);
      EF_10=iMA("EURCHF",PERIOD_M5,50,0,MODE_SMA,PRICE_WEIGHTED,0);
      EF_10=iMA("EURCHF",PERIOD_M5,100,0,MODE_SMA,PRICE_WEIGHTED,0); 
    
    Print("JPY  ",EJ_10,"  ",EJ_20,"  ",EJ_30);
    Print("CHF  ",EF_10,"  ",EF_10,"  ",EF_10);
}

i had tried on changed the symbol1="EURJPY" to "GBPJPY" or the others, it occurs the same problem!

but i code other symbols seperately,it works that retrun me the correct number !! Except symbol1"EURJPY" and "EURCHF".

 

K

1) Try the pair name "EURJPY", I'm not familiar with EURJYP...

2) I guess you are on a sub-pip account, so check out DoubleToStr to get the fifth decimal place in the Print output for EURCHF

Good Luck

-BB-

 
BarrowBoy wrote >>

K

1) Try the pair name "EURJPY", I'm not familiar with EURJYP...

2) I guess you are on a sub-pip account, so check out DoubleToStr to get the fifth decimal place in the Print output for EURCHF

Good Luck

-BB-

yes ! BarrowBoy, i did using a Alpari demo account which is sub-pip . i have try on other pairs and it can prints me the correct number which is near to the outside Ma average indicators .

but only EURJPY and EURCHF could not makes right . I'm wondering whether is problem of coding.

 
kelvin325 wrote >>

yes ! BarrowBoy, i did using a Alpari demo account which is sub-pip . i have try on other pairs and it can prints me the correct number which is near to the outside Ma average indicators .

but only EURJPY and EURCHF could not makes right . I'm wondering whether is problem of coding.

BarrowBoy was telling you before ... ;-)

>>Try the pair name "EURJPY", I'm not familiar with EURJYP...

 
EADeveloper wrote >>

BarrowBoy was telling you before ... ;-)

>>Try the pair name "EURJPY", I'm not familiar with EURJYP...

Thanks EAD, was having a despairing moment there...

..

Kelvin325?

Yoda says "Coding less and reading more, better it is" :)

-BB-

 

Appreciated ! you guys ~~i did OVERCOME it now !! ......

Reason: