How to place multiple orders only when with enough money?
When in doubt, read the documentation and/or search the forum. I am just going to quote WHRoeder, as he has this always well organised:
WHRoeder:
- Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. You must normalize lots properly and check against min and max.
- 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 also check FreeMargin to avoid stop out
How to place multiple orders only when with enough money?
Say I need to order 4 different pairs in the order of: EUR/USD, EUR/JPY, GBP/USD, USD/CHF.
Is there a way to check is I have enough money before opening the first order?
It has to be all 4 pairs or nothing.