MarketInfo on offline client in portable mode returns "empty" values.

 

Hey,

Using MT4 build 610 from Alpari in offline mode with the /portable runtime switch, I've hit several cases where MarketInfo() don't return meaningful values.

These few script lines shows what I get:

double tick_value = MarketInfo(Symbol(), MODE_TICKVALUE);
Print("Tick value : ",tick_value);                                   // Offline tick_value == 0.0

string lot_step = DoubleToStr(MarketInfo(Symbol(), MODE_LOTSTEP));   // Offline lot_step == 0
Print("Lot step : ",lot_step);

string min_lot = DoubleToStr(MarketInfo(Symbol(), MODE_MINLOT));     // Offline min_lot == 0
Print("Min. lots : ", min_lot);
   
string max_lot = DoubleToStr(MarketInfo(Symbol(), MODE_MAXLOT));     // Offline max_lot == 0.
Print("Max. lots : ", max_lot);


double risk = AccountBalance() * 2.0 / 100.0;                        // Offline AccountBalance() returns 0
Print("Risk : ", risk);

The above ofcourse works perfectly well in online mode, when there's a Trade tab visible in the client.

MT4 is installed outside the %Program Files% path.


https://forum.mql4.com/46922 and https://forum.mql4.com/57278 somewhat approaches the issue I'm seeing but leaves me no further to a solution.

Staying in online mode opens up a whole new lot of issues with testing I'd most certainly want to avoid.

Perhaps you've found a solution you'd like to share?

 

Read this topic

 
filson:

Hey,

Using MT4 build 610 from Alpari in offline mode with the /portable runtime switch, I've hit several cases where MarketInfo() don't return meaningful values.

These few script lines shows what I get:

The above ofcourse works perfectly well in online mode, when there's a Trade tab visible in the client.

MT4 is installed outside the %Program Files% path.


https://forum.mql4.com/46922 and https://forum.mql4.com/57278 somewhat approaches the issue I'm seeing but leaves me no further to a solution.

Staying in online mode opens up a whole new lot of issues with testing I'd most certainly want to avoid.

Perhaps you've found a solution you'd like to share?

Current build(s) are 625/628, which are correcting a lot of problems from build 610.
 

I've updated to build 646 (latest as of today).

That does not solve the problem, angevoyageur.


I'll try the script fai made (i suppose that's what you refer to, qjol), although it seems written only for spread data.

Spread is increadibly important but it's not the only thing I need. MODE_TICKVALUE is of even higher priority.


Is the issue with missing offline MarketInfo data only relevant for scripts or does it also hamper offline Strategy Tester work?

 
filson:

I've updated to build 646 (latest as of today).

That does not solve the problem, angevoyageur.


I'll try the script fai made (i suppose that's what you refer to, qjol), although it seems written only for spread data.

Spread is increadibly important but it's not the only thing I need. MODE_TICKVALUE is of even higher priority.


Is the issue with missing offline MarketInfo data only relevant for scripts or does it also hamper offline Strategy Tester work?

If you found a bug with MT4, please report it to ServiceDesk of Metaquotes.
 

Thank you angevoyageur.

Could you link my mql4 account to the mql5 login so I can get the Service Desk/New Request bit in my profile?

Currently I get an invalid login error when using this account to log into mql5.com, and an username and email already in use when trying to register on mql5.

 

Maybe you signed up in the past try Password recovery

 
qjol:

Maybe you signed up in the past try Password recovery

I can confirm, this is the procedure to follow.
 
Thank you.
 

Hi filson. 

Did you got this resolved?

I have exactly the same issue and can't seem to find a solution anywhere on the web.

When I run EA backtest Online its all good, but when running back test in offline I can't get  correct lot step and tick value so have wrong lot sizes for my trades.

When I run your script it returns 0 values

 

Reason: