# [ MQL] Please tell me how to select order by timeframe in one chart.

259

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?

10014

kajironpu:

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.

259

Vitalii Ananev:

The easiest solution is to open positions with different magic numbers.

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

16414

kajironpu:

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.

10014

kajironpu:

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;
...
....
```
```.....

{
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.

259

Vitalii Ananev:

Yeah, that's what I meant.

Can be done for example so:

Thus, your positions will be different from each other.