
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
1) The first OrderSend() is checked that it was successful by testing that the return value is greater
than zero before attempting to place the second order.
2) To identify and process order pairs you could base your code on the following if the order pairs
were comprised of different types (however the algorythm would have to be altered if the grouping
was more than 2 or if the orders in a group were all of the same type):
The sample program "ReportsTrader.mq4" that follows places straddle orders near the issue of
reports or news events.
A straddle order is comprised of two pending orders above and below the market price. When one
pending order hits the market price it is changed into a market order and the other pending
order has to be deleted. So the order pairs require a sequence number to track them.
I don't know if you ever solved this problem Chee Chua, but I got very close to being able to do the same thing.
My system creates pricelevels (based on my inputs at the start) which are then supposed to be permanent, so that if price revisits a pricelevel and an order does not exist an order is placed. These pricelevels are created when each pending order is created using a for loop. The magicnumber is then derived from the pricelevel.
You can see my code here:
https://www.mql5.com/en/forum/306224
My only problem is that sometimes my number comes out 1 digit less than the Pricelevel of the trade which I cannot solve.