Check with the debugger with broker account where and when your functions fails:
https://www.metatrader5.com/en/metaeditor/help/development/debug
https://www.mql5.com/en/articles/654
https://www.mql5.com/en/articles/35
https://www.mql5.com/en/articles/2041
https://www.mql5.com/en/articles/272
https://www.mql5.com/en/articles/150
Code debugging - Developing programs - MetaEditor Help
- www.metatrader5.com
MetaEditor has a built-in debugger allowing you to check a program execution step by step (by individual functions). Place breakpoints in the code...
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have an existing EA that i use on different brokers with the following formular to calculate it's position size:
double GetLot(double risk, int sl = 0)
{
double Free = acc.Balance();
double tick_value = smb.TickValue();
double tick_size = smb.TickSize();
if(sl <= 0 || tick_value <= 0)
return(Free/1000*smb.LotsMin()*risk);
double LotVal = tick_value *_Point /tick_size;
double Step = smb.LotsStep();
double lot = MathFloor((Free*risk/100)/(sl*LotVal)/Step)*Step
return(lot);
}
but somehow on one broker the value of the lot sizes is way too small Please find attached the specifications for 3 instruments i'm currently trading. On the brokers where the above formular works, the tick size and tick value is set to 0. The broker who provides tick size and tick value the formular: = MathFloor((Free*risk/100)/(sl*LotVal)/Step)*Step; does not work.
Does anybody knows how to fix this?