Download MetaTrader 5
To add comments, please log in or register
Do you have questions on how to turn your idea into reality? Ask them on the Forum!
elanin
66
elanin 2016.06.21 08: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);
whroeder1
13610
whroeder1 2016.06.21 12: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
/
To add comments, please log in or register