Tickvalue in strategy tester???

 

Hi. I'm new to mql4 language, but I understand the basics.

I'm testing my EA on Stretegy tester, but noticed that on some pairs (USDJPY,USDCHF,USDCAD) lot size calculation is off.

I use this function to get tickvalue and on real trading it works fine, also on most of the pairs in Stretegy tester works fine too.  

 

double lot = MathFloor(((risk/NumberOfOrders))/(((sl-openPrice)/Point)*MarketInfo(Symbol(),MODE_TICKVALUE))/LotStep)*LotStep;

The only think I could think is that history doesn't not have correct tick value??? But very strange that it effects only pairs where USD is 1st currency. Could it be something to do with code?

Thanks for any help guys.

 
ivolux:

Hi. I'm new to mql4 language, but I understand the basics.

I'm testing my EA on Stretegy tester, but noticed that on some pairs (USDJPY,USDCHF,USDCAD) lot size calculation is off.

I use this function to get tickvalue and on real trading it works fine, also on most of the pairs in Stretegy tester works fine too.  

 

double lot = MathFloor(((risk/NumberOfOrders))/(((sl-openPrice)/Point)*MarketInfo(Symbol(),MODE_TICKVALUE))/LotStep)*LotStep;

The only think I could think is that history doesn't not have correct tick value??? But very strange that it effects only pairs where USD is 1st currency. Could it be something to do with code?

Thanks for any help guys.

What value do you get ?

What is your account currency ? Do you have the needed crosses in the Market Watch ?

 
angevoyageur:

What value do you get ?

What is your account currency ? Do you have the needed crosses in the Market Watch ?

Risk per order should be 100.00 USD, but I get anything form 170.00 to 80.00 USD.

All symbols on market watch.

I only have this issue on Strategy tester and its the same on 2 different Mt4 

 

 I found the issue. I opened the demo account on EUR, but run the test on USD. 

Thanks for pointing me in right direction

Cheers