For example,the EA places orders (using iCustom signal in one chart).
order#1 buy (EA ordered with signal of time frame M5) ---iCustom(NULL,5,"indicator name",0,1)
order#2 buy (EA ordered with signal of time frame H1) ---iCustom(NULL,60,"indicator name",0,1)
order#3 sell (EA ordered with signal of time frame M5) ---iCustom(NULL,5,"indicator name",1,1)
Now I have total three orders in one basket.
and I want to select and close the order #1 only, which was placed with signal of timeframe M5.
How can I select the order #1? I don't want to close order #2,3.
Is it possible to select order with different time frame? How can I do it?
The easiest solution is to open positions with different magic numbers.
The easiest solution is to open positions with different magic numbers.
Vitalii, thank you for your advice.
To change magic number, you mean different magic number by each time frame, right?
EX) MAGIC#111 =Time frame M5 order
MAGIC#222=Time frame H1 order
Vitalii, thank you for your advice.
To change magic number, you mean different magic number by each time frame, right?
EX) MAGIC#111 =Time frame M5 order
MAGIC#222=Time frame H1 order
to minimize ambiguity, use different magic number for each order.
Vitalii, thank you for your advice.
To change magic number, you mean different magic number by each time frame, right?
EX) MAGIC#111 =Time frame M5 order
MAGIC#222=Time frame H1 order
Yeah, that's what I meant.
Can be done for example so:
.... int Magic = 555; ... OrderSend(Symbol(),OP_BUY,Lot,Pr,Slipage,0,0,"",Magic+PERIOD_H1,0,clrNONE); OrderSend(Symbol(),OP_BUY,Lot,Pr,Slipage,0,0,"",Magic+PERIOD_M5,0,clrNONE); ....
..... if(OrderSelect(i, SELECT_BY_POS,MODE_TRADES)) { if (OrderMagicNumber()==Magic+PERIOD_H1 && OrderSymbol()==Symbol()) { .... //Any action with the position } if (OrderMagicNumber()==Magic+PERIOD_M5 && OrderSymbol()==Symbol()) { ..... ///Any action with the position } } ...
Thus, your positions will be different from each other.
Yeah, that's what I meant.
Can be done for example so:
Thus, your positions will be different from each other.
Thank you so much. Your sample code is very helpful.
I will try that!
to minimize ambiguity, use different magic number for each order.
Great idea! Thank you!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
For example,the EA places orders (using iCustom signal in one chart).
order#1 buy (EA ordered with signal of time frame M5) ---iCustom(NULL,5,"indicator name",0,1)
order#2 buy (EA ordered with signal of time frame H1) ---iCustom(NULL,60,"indicator name",0,1)
order#3 sell (EA ordered with signal of time frame M5) ---iCustom(NULL,5,"indicator name",1,1)
Now I have total three orders in one basket.
and I want to select and close the order #1 only, which was placed with signal of timeframe M5.
How can I select the order #1? I don't want to close order #2,3.
Is it possible to select order with different time frame? How can I do it?