Buy only on Timeframes?

 

Hi,

Iam a newbee on this platform and trying my self forward...

I would like an Expert advisor that only buys/sells on a specifik time on the day.

any tips on this?


Thanks?

 
Yes you can use a 
datetime
Variable for that.
 
skrantz71:

Hi,

Iam a newbee on this platform and trying my self forward...

I would like an Expert advisor that only buys/sells on a specifik time on the day.

any tips on this?


Thanks?

Look into using the OnTimer() or OnTick() event and then check TimeCurrent() when it gets called?
 
skrantz71:

Hi,

Iam a newbee on this platform and trying my self forward...

I would like an Expert advisor that only buys/sells on a specifik time on the day.

any tips on this?


Thanks?

You could use TimeCurrent like this:

MqlDateTime dt;
TimeCurrent(dt);
if(dt.hour==10 && dt.min==00 && CountOpenPositions()==0) OpenPosition();
Reason: