# Beginner >> Need support?

7227

I want to place the order on specified candle. is there any mt4 functions available to know thecount of candle.

eg:

I want to place the order on 4th candle open price!.for that i need to validate the current candle count.

Please support me, is there any function available?

17627

sheriffonline:

I want to place the order on specified candle. is there any mt4 functions available to know thecount of candle.

eg:

I want to place the order on 4th candle open price!.for that i need to validate the current candle count.

Please support me, is there any function available?

4th candle from when ?
7227

RaptorUK:
4th candle from when ?

Market open at 00.00,using 1hr candle.

00.00-00.59=Candle1
1.00-1.59=Candle2
2.00-2.59=Candle3
3.00-3.59=Candle4

I like to place order at Candle4 open value.

i need simple method to find bar count, if the current candle is 4th candle since market open, ea place order.

17627

sheriffonline:

Market open at 00.00,using 1hr candle.

00.00-00.59=Candle1
1.00-1.59=Candle2
2.00-2.59=Candle3
3.00-3.59=Candle4

I like to place order at Candle4 open value.

i need simple method to find bar count, if the current candle is 4th candle since market open, ea place order.

First define your starting point, if that is Midnight then use iBarshift() to get the midnight candle bar number, if that candle is bar 3 (current candle is bar 0) then place your order using Open[3]
6530

sheriffonline:

Market open at 00.00,using 1hr candle.

00.00-00.59=Candle1
1.00-1.59=Candle2
2.00-2.59=Candle3
3.00-3.59=Candle4

I like to place order at Candle4 open value.

i need simple method to find bar count, if the current candle is 4th candle since market open, ea place order.

first you need to know how you can find market is opening

today it might be the market was trading again at 00:00

but coming night same time it is already open.... the market is not closing today...

so how do you know market is closed and how do you know market is open ??

7227

deVries:

first you need to know how you can find market is opening

today it might be the market was trading again at at 00:00

but coming night same time it is already open.... the market is not closing today...

so how do you know market is closed and how do you know market is open ??

I validate the day. so everyday i get new market open hours.

```{
if (nday != Day())
{
Return();

}```
6530

sheriffonline:

I validate the day. so everyday i get new market open hours.

That is not opening at new market the market is open 24 hours a day or 5 times 24 hours

what you want when the day is 3 hours old the EA has to trade

brokers have different timezones so on other account it might be you have to change settings to get it trade the same

for your code there are several ways to handle

```{
int nday = TimeDay(Time[3]);
if(nday != Day())
{
return();

}```

using your code i would define it like this ofcours on a 1H chart

and also not capital letter return()

17908

sheriffonline:

Market open at 00.00,using 1hr candle.

00.00-00.59=Candle1
1.00-1.59=Candle2
2.00-2.59=Candle3
3.00-3.59=Candle4

I like to place order at Candle4 open value.

i need simple method to find bar count, if the current candle is 4th candle since market open, ea place order.

You don't need a bar count at all, simply wait until time reaches 0400. The Bid is the open value.
Not compiled, not tested.
```#define HR2400 86400       // 24 * 3600
int      TimeOfDay(datetime when){  return( when % HR2400          );         }
datetime DateOfDay(datetime when){  return( when - TimeOfDay(when) );         }
datetime Tomorrow( datetime when){  return( DateOfDay(when) + HR2400 );       }

int init(){
datetime now = TimeCurrent();
if( TimeOfDay(now) > HR0400) nextTradeAllowed = Tomorrow(now)  + HR0400; // Too late for today.
else                         nextTradeAllowed = DateOfDay(now) + HR0400; // Wait for 04:00.
}
int start(){
:
datetime now = TimeCurrent();
if(now >= nextTradeAllowed){                  // Time to open.
nextTradeAllowed = Tomorrow(now) + HR0400; // Once per day
int ticket = OrderSend( ...                // Open now at first tick
:
}
}
```
Not compiled, not tested.