Indicator problem in EA - return 0 when call same indicator with different period

 

Hi All,

I have encountered a problem during writing EA, anybody could enlighten me?

Problem in displaying 2 value from the same indicator with different period setting.

Second value always display 0.

double Demark_Test(){

double Demark1 = iDeMarker(NULL,PERIOD_M5,14,1);

double Demark2 = iDeMarker(NULL,PERIOD_H1,14,1);

Alert ("Demarker 1=",Demark1 );

Alert ("Demarker 2=",Demark2 );

}

Result

Demarker 1=0.2128

Demarker 2= 0

Anyone could help?

Thanks a million.

 

I cut/pasted your two lines for Demark1 & Demark2- and then ran the EA with "Print" command.


I didn't get any problems. So it must be some other part of the code. It printed out both the values of the Demarker just fine.


And if you remove the double Demark_Test() (and the brakets before and after it) and compile it- it runs just fine too.


I don't know what the function of Demark_Test is, so I couldn't fully test all of the code, because it wouldn't compile.


I hope that helps,


-Jacob

 

Thanks for replying to my enquiry. Appericated and thanks!. Cheers

With your reply, it give me an idea and tried it. Seems like on the Tester, I have to select the Period to be 1H instead of M5 and this works.

Previously, I have selected M5 in Tester, which give 0 value for Demarker parameter set at H1. I guess the H1 data is not loaded in the Tester, only M5. Therefore result with 0.

Cheers to you.!!