MT4 adding commission to (risk) lot size calculaton.

Back to topics list To post a new topic, please log in or register
elanin 2016.06.21 10:52

I am using below code to calculate lot size before opening order, but now I changed to ECN accout that has commission.

Is it possible add commission to lot size calculation before order is open on a symbol?

double lots    = AccountBalance()*(RiskPercent/100.0)/(StopLoss*pipValue);
WHRoeder 2016.06.21 14:29 #
  • You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
  • Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerlot + CommissionPerLot) (Note OOP-OSL includes the SPREAD)
  • Do NOT use TickValue by itself - DeltaPerlot
  • You must normalize lots properly and check against min and max.
  • You must also check FreeMargin to avoid stop out
Back to topics list  

To add comments, please log in or register