Do a search for Straddle_Trail.mq4 by Yannis. That should cover your needs with a few mods.
Ok, will do. Thanks.
Is there a way to find out the magic number of a live (not a pending) order?
OrderMagicNumber () seems to give me the magic number of the current order that I am about to place.
Ok, will do. Thanks.
Is there a way to find out the magic number of a live (not a pending) order?
OrderMagicNumber () seems to give me the magic number of the current order that I am about to place.You can get Magic Numbers from any order even closed orders in history.
I did something in the pass were the EA generated a 3 digit number for a Magic Number it then multiplied it by 100 to give me a 5 digit number for a run magic that is say 12300 with that each set of orders were assigned a 10 count that is 10, 20, 30 etc... and each order of the set was assigned a signal digit number to track the different orders of that set. All you do is add all these together and you have a different Magic Number for each order like this
Magic number is 123
set of orders 10
each order of set 1
2
3
4
The end results are;
12311
12312
12313
12314
now you test the first 3 digits of the MN to find all orders to your system the 4th is the order set and the last is your orders. You now can find each order with the MN.
Keit
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I have the following requirement. I am trying to write an OCO (one cancels the other) type of logic.
1) Say I have 2 live buy orders (eg., A & B). I need to place 4 pending orders for the same currency pair : 2 buy & 2 sell. (say C & D are buy and E & F are sell).
Now if any of the new pending orders become live, then I need the other pending orders for the same currency pair cancelled and moved 20 pips closer to the orders that just became live.
If C & D become live, then I should have these orders :
A, B, C & D (all are live buy orders).
E & F (both are sell pending orders, 20 pips below C or D whichever is lower).
(If C & D were live sell orders, then E & F should be buy pending orders, 20 pips above C or D whichever is higher.)
2) If the new live orders (C & D) close in profit, then I need to cancel the pending orders (E & F).
Not sure how much of coding this would require. Can someone please help me to code this?
Thanks
-Gc