Possible dangerous BUG in offline charts

 

Hello to everyone.

I'm experiencing an issue on EA made by myself that works on Renko (using offline charts).

Inside the routine OnInit() I've calculated PipValue of the pair in this way:


double PipValue;

int OnInit()
{
   double LotSize = 1;
   PipValue =(((MarketInfo(Symbol(),MODE_TICKVALUE)*point)/MarketInfo(Symbol(),MODE_TICKSIZE))*LotSize);

.....


as you can see PipValue is a "public" Double variable defined before the OnInit() routine.

The issue that I have is that PipValue variable assumes ZERO value after the EA takes a trade!!   So inside the  OnTick()  event I was forced to calculate it again to use it in my calculations...

The first question is: why variable goes to ZERO? 

Second question is: why JUST that variable goes to zero?  I have many other variables calculated on the OnInit() .... and all work nice...


Any idea?!!   Thanks in advance.

 
You mast have a valid connection to your broker for some time otherwise you'll get false values like 0.0!
 

Issue is not related to Broker connection: I'm forward testing this EA on many platforms (Demo & Real on different brokers) and issue happens in the same way on ALL the platforms!!

That variable is calculated ONCE (during init) and it's calculated correctly....  the mistery is that during EA execution that variable goes to Zero (this happens right after a new trade).

I've checked the source code and that variable is assigned ONLY in the Init event .... in the remaining code it is just read, not assigned.

I've spent sleepless nights and the reason behind this issue remains a big mistery.  I suspect there's a Bug in the Platform and for this reason I've explained my issue here.....


Thanks to everyone could help.



 
mt4fan:

Issue is not related to Broker connection: I'm forward testing this EA on many platforms (Demo & Real on different brokers) and issue happens in the same way on ALL the platforms!!

That variable is calculated ONCE (during init) and it's calculated correctly....  the mistery is that during EA execution that variable goes to Zero (this happens right after a new trade).

I've checked the source code and that variable is assigned ONLY in the Init event .... in the remaining code it is just read, not assigned.

I've spent sleepless nights and the reason behind this issue remains a big mistery.  I suspect there's a Bug in the Platform and for this reason I've explained my issue here.....


Thanks to everyone could help.



Either it's in your code, either it's zero from the start (init). We don't see your code, and MarketInfo data can be zero in some circumstances.

Which MT4 build are you using ?

 

Build of terminal is 920 and 940.

Value of the variable is displayed on chart by the EA (at each tick): so I know for sure that PipValue variable has the correct value .... until the execution of a new trade!!

 
mt4fan:

Build of terminal is 920 and 940.

Value of the variable is displayed on chart by the EA (at each tick): so I know for sure that PipValue variable has the correct value .... until the execution of a new trade!!

So your code is changing the value.
Reason: