To use chat, please login.
Back to contacts

Need some help programming a strategy

Allanr0
Nov 18 2015 at 11:07
3 posts
Hi guys, i made it, if someone want it is uploaded.

But what i want to do to this ea, is to program him, to trade automatically just in a specific hours.
ex: from 9:00 am to 3:00 pm.

Could be this done?

Attachments:


FSM (dkilmer)
Nov 21 2015 at 07:35
90 posts
You can use the Hour() function to get the current hour on the server.
On mine it shows 12, which it is 9:30 right now (PST) , so if you want to do 9am-3pm your time, you will need to adjust the integer.

int hour = Hour();
Comment(IntegerToString(hour)); // so you can see what is in this variable

hour = hour - 3; // if I was to adjust it for 9am-3pm my time

if((hour >= 9) && (hour < 15)){
    //// Allow for trading
}else{
    //// otherwise after hours
}


hope this helps

Everything in the market is like a fart, if you have to force it, it is probably shit
Allanr0
Nov 24 2015 at 07:30
3 posts
Professional4X
Jan 09 2016 at 18:43
1189 posts
Does anyone even bother reading API or DOCS any longer?

TimeLocal()
TimeCurrent()

Those are built in functions for dealing with server and local times.


*cough* RTFM....

If it looks too good to be true, it's probably a scam! Let the buyer beware.
Please login to comment .