I have my entry and my stop-loss and I want to calculate the lot size according to my risk-management. It works fine and this is how I do it:
double pipRisk = MathAbs(orderOpenPrice-orderStoploss);
double lotSize = AccountBalance()*0.01 / pipRisk / (MarketInfo(_Symbol, MODE_TICKVALUE)/MarketInfo(_Symbol, MODE_TICKSIZE));
lotSize = MathRound(lotSize/MarketInfo(_Symbol, MODE_LOTSTEP))*MarketInfo(_Symbol, MODE_LOTSTEP);
Now I want to include the commissions into this calculation. My broker charges $7 for a full roundturn. I wanted to convert the commission into pips and add them to the variable "pipRisk".
Because I have a Euro-based account I think I have to convert the commission into Euro first:
double commissionEURPerLot = 7/MarketInfo("EURUSD", MODE_BID);
But now I am lost... I have no idea how to include the commission into my risk-calculation. Can anyone help me?
I can only use OrderCommission() if I have an existing order. But I need to calculate the lotsize including the commission before I place a trade.
I tried something like this but I don't really understand what I am doing here...
double commissionUSDPerLot = 7;
double commissionEURPerLot = commissionUSDPerLot/MarketInfo("EURUSD", MODE_BID);
double commissionPerLotInPips = (commissionEURPerLot/MarketInfo(_Symbol, MODE_TICKVALUE))*MathPow(10, -(_Digits-1));
basicly if your broker commission is 7 ( round turn ) your commission will be equal to 0,7 spread per 0,01 lot
I think =)
Imagine if you want to trade GBP/NZD and you have a EUR-account. A roundturn of 100,000 GBP/NZD costs $7. But how do you integrate the commission-costs in USD into GBP/NZD when you have a EUR-account?
I guess you have to convert the $7 into NZD first and then convert the NZD amount somehow to the spread.
I think this is really complex. Or maybe it's easy but I don't know how to do...?!
What do you mean with commissionInMoney? Which amount and which currency? I only know the general commission which is $7 per roundturn.
Commission round turn / lot in account currency. In your case commissionInMoney = 7.0
Because I have a EUR account I changed it to:
But unfortunately that doesn't work correct. The calculated lotsize is too high for the 1% risk.