You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
That is incorrect [...]
Let me be clearer...
In back-testing, this will place two orders at the Ask price. In forward-trading, probably not. If the broker uses market execution then the price and slippage parameters for the second order will be ignored, and the price logged in advance using Print() for the second order will probably be different to the fill price - i.e. more different, on average, than for the first order. (If the broker uses instant execution, then the second order may nor may not be rejected.)
The following creates a log which is a more reliable indication of whether or not there has been slippage between the last-known price in the MT4 platform and the eventual fill price of an order:
You can obviously use RefreshRates() and Ask or Bid instead of MarketInfo() ... provided that you do in fact remember to use RefreshRates() in all the required places.
The broader topic incudes code such as the following:
The static nature of Ask and Bid during start() encourages bugs. You can be as un-"ignorant" of MQL4 as you like, but my personal view is that routine use of MarketInfo() is a worthwhile trade-off compared to use of Ask and Bid.