Position size value too low

 

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?

 
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...