Calculating position size
HarriMQL5: Can anyone spot anything wrong with this code, either logically
lAmt = amtToRisk / MarketInfo(ccyCur+AccountCurrency(), MODE_BID); : double pos1 = (lAmt / stopLoss) ;What do you think currency/bid/pips means? Nothing! Babel!- In code
- 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, and DeltaPerLot is usually around $10/pip)
- 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
- Use a GUI: Indicators: 'Money Manager Graphic Tool' indicator by 'takycard' Forum - Page 5
Hello
Im using this code snippet to calculate position size
Can anyone spot anything wrong with this code, either logically or programmatically?
Thanks!