Download MetaTrader 5

iSAR MT4 indicator returns wiered values.

To add comments, please log in or register
Martin Nohejl
497
Martin Nohejl  

Hi,

I'd like to compare iSAR indicator on more timeframes and also on a different symbol.

It works properly for different timeframes of the current symbol.

For the different symbol it returns correct value (see 1. variable usdind_01_sar).

But if I will print it out or want to compare the value, the condition doesn't work and zero is printed out (check 2.)

 

 Does anyone have a cloe what is wrong? 

 Thanks a lot. 

Files:
20170224.JPG 276 kb
newEA.mq4 9 kb
Martin Nohejl
497
Martin Nohejl  
Whould anyone could help me please??
honest_knave
Moderator
2342
honest_knave  
Thorpe027:
Whould anyone could help me please??

It is just waiting for data to load for the other symbol (and other timeframes).

I ran your code on a terminal that never had a USDIndMar17 chart open.

The markets are shut so I set it to call OnTick() every 5 seconds.

Notice how the first call returned 0, then the subsequent calls returned a correct value.

So between the first call and the 2nd call (5 seconds later), the data was retrieved.

You can also see how the data from other timeframes (M5 and M15) changed between the first and second calls, as that data was updated too. 

Hope that helps

 

Martin Nohejl
497
Martin Nohejl  
honest_knave:

It is just waiting for data to load for the other symbol (and other timeframes).

I ran your code on a terminal that never had a USDIndMar17 chart open.

The markets are shut so I set it to call OnTick() every 5 seconds.

Notice how the first call returned 0, then the subsequent calls returned a correct value.

So between the first call and the 2nd call (5 seconds later), the data was retrieved.

You can also see how the data from other timeframes (M5 and M15) changed between the first and second calls, as that data was updated too. 

Hope that helps

 

What do you mean it's waiting for data to load?

I ran it many times, I had also displayed that symbol.

I don't know why this is happening. It works for the current symbol even for different timefrime. The value is also righ when I see it in whatch variable window but printed is always 0.

So what should I do? 

honest_knave
Moderator
2342
honest_knave  
Thorpe027:

What do you mean it's waiting for data to load?

I ran it many times, I had also displayed that symbol.

I don't know why this is happening. It works for the current symbol even for different timefrime. The value is also righ when I see it in whatch variable window but printed is always 0.

So what should I do? 

Odd. As you can see from my screenshots, it works as expected. Are you running this through strategy tester by any chance?
Martin Nohejl
497
Martin Nohejl  
honest_knave:
Odd. As you can see from my screenshots, it works as expected. Are you running this through strategy tester by any chance?

Yes I do but whith the same result (zeros as you can see on the screenshot). :( 

Its wiered that I get the High of the symbol USDIndMar17 as you can see, which is printed right after the iSAR indicator.

Files:
whroeder1
17122
whroeder1  
Thorpe027: What do you mean it's waiting for data to load?
WHAT KIND OF BUG IS THIS ONE?!?!?! - MQL4 and MetaTrader 4 - MQL4 programming forum

To add comments, please log in or register