Order Execution on a Specific Day of the Week

How to create strategies and indicators
Message
Author
gidnoa
Posts: 9
Joined: Fri Aug 01, 2008 11:18 am

Order Execution on a Specific Day of the Week

#1 Postby gidnoa » Mon Aug 04, 2008 4:53 pm

Hi Mike,
I'm trying to open orders at specific time and day (monday).
I tried entering DayOf(time) =2 for monday, but it seems this opens an order on the 2nd of the first month i test. I tried a loop adding 7 days, but no order triggered after the initial month ended.
How are days counted in ForexTester?
[Are they numbered from 1899 like you explained in the sticky?, then why did an order open for the 2nd,9th,16th... of the 1st month?]

Code: Select all

if (HourOf(time) = 8)  and (DayOf(time) =?) then
    begin ...

Any help would be appreciated!

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

Re: Order Execution on a Specific Day of the Week

#2 Postby Terranin » Mon Aug 04, 2008 6:13 pm

gidnoa wrote:Hi Mike,
I'm trying to open orders at specific time and day (monday).
I tried entering DayOf(time) =2 for monday, but it seems this opens an order on the 2nd of the first month i test. I tried a loop adding 7 days, but no order triggered after the initial month ended.
How are days counted in ForexTester?
[Are they numbered from 1899 like you explained in the sticky?, then why did an order open for the 2nd,9th,16th... of the 1st month?]

Code: Select all

if (HourOf(time) = 8)  and (DayOf(time) =?) then
    begin ...

Any help would be appreciated!


You should use function DayOfTheWeek(time), if will return Monday = 1 ... Sunday = 7
Hasta la vista
Mike

gidnoa
Posts: 9
Joined: Fri Aug 01, 2008 11:18 am

#3 Postby gidnoa » Tue Aug 05, 2008 8:54 am

Thanks!
Is there a place I could've seen this function?

User avatar
Terranin
Site Admin
Posts: 833
Joined: Sat Oct 21, 2006 4:39 pm

#4 Postby Terranin » Tue Aug 05, 2008 9:16 am

gidnoa wrote:Thanks!
Is there a place I could've seen this function?


This is a standard Delphi function from DateUtils unit.
Hasta la vista

Mike


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 32 guests