trying to buy at the end of the hour

 

I'm making an expert advisor that tries to open a position as close to the end of the 1-hour bar as possible (within seconds or, even better, milliseconds).

How do you suggest I accomplish this?

 

My good buys are in the first 2 hours of the open then from 10:30 - 11:45 and the last 5 minutes before the close...

 

If(High[0] == Close[0] && High[0] == Open[0] && High[0] == Low[0])
buy();

This ensures you are trading at the beginning of the first bar.

 

hi MechXTrader,

so your code gives a true value immediately when a new bar starts? is this right?

Reason: