Set regular trading hours?

Posted By: Dalla

Set regular trading hours? - 02/28/17 07:48

Is there any parameter that I can set to determine the regular trading hours for my algo, ie "Don't trade before this time and exit all positions at that time".

Currently I'm doing this manually like so

//Only enter trades during these hours
if (hour() >= 9 && minute() >= 0 && hour() <= 17 && minute() <= 29)
{
...
enterLong();
...
}

if (hour() >= 17 && minute() >= 30)
{
exitLong();
}
Posted By: Veli

Re: Set regular trading hours? - 02/28/17 14:53

Hi Dalla smile

I haven't found a parameter so far. Like you I'm curious if there is one.

Similar to you I use an IF statement:
Code:
if(ltod(CET) >= 900 && ltod(CET) <= 1729)
{
  ...
  enterLong();
  ...
}



Does someone else have any ideas? wink

Best wishes

Veli
Posted By: therealLeon

Re: Set regular trading hours? - 03/01/17 10:28

Hi,

@Veli: Your way is the same way i handle timeframes for trading.

BR

Leon
© 2024 lite-C Forums