Need some direction on time functions

How to create strategies and indicators
Message
Author
patronus
Posts: 8
Joined: Tue Apr 15, 2008 4:31 pm
Location: Sacramento CA

Need some direction on time functions

#1 Postby patronus » Wed Apr 16, 2008 4:05 pm

I'm trying to create a simple indicator that would put a simple "*" over the 10:00am bar on a 15min chart. What function would I use to find that bar? I've attempted to use the sample for time but I get error hour not defined. Any help would be appreciated.

Thanks...Dave

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

Re: Need some direction on time functions

#2 Postby Terranin » Wed Apr 16, 2008 5:17 pm

patronus wrote:I'm trying to create a simple indicator that would put a simple "*" over the 10:00am bar on a 15min chart. What function would I use to find that bar? I've attempted to use the sample for time but I get error hour not defined. Any help would be appreciated.

Thanks...Dave


To use date functions you should include DateTimeUtils unit for Delphi. For C++ I am not very familiar with its libraries.

So for Delphi it will look like:

Code: Select all

if (HourOf(Time(index)) = 10) and (MinuteOf(Time(index)) = 0) then
  buff[index] := High(index)
else
  buff[index] ;= 0;
Hasta la vista
Mike

User avatar
Tantalus
Posts: 302
Joined: Fri Mar 23, 2007 3:51 pm
Contact:

Re: Need some direction on time functions

#3 Postby Tantalus » Fri Apr 18, 2008 2:18 pm

Terranin wrote:
patronus wrote:I'm trying to create a simple indicator that would put a simple "*" over the 10:00am bar on a 15min chart. What function would I use to find that bar? I've attempted to use the sample for time but I get error hour not defined. Any help would be appreciated.

Thanks...Dave


To use date functions you should include DateTimeUtils unit for Delphi. For C++ I am not very familiar with its libraries.

So for Delphi it will look like:

Code: Select all

if (HourOf(Time(index)) = 10) and (MinuteOf(Time(index)) = 0) then
  buff[index] := High(index)
else
  buff[index] ;= 0;


Mike, wouldn't that be:

Code: Select all

HourOf(Time[index])


where the index of the Time array is contained in square brackets, not parentheses?

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

#4 Postby Terranin » Fri Apr 18, 2008 2:32 pm

Open, High, Low, Close and Time are functions. Not real arrays, so they should be used like this Time(index), Open(index + 1).
Hasta la vista

Mike

patronus
Posts: 8
Joined: Tue Apr 15, 2008 4:31 pm
Location: Sacramento CA

#5 Postby patronus » Sun May 04, 2008 10:35 pm

Thanks guys that helped alot.


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 18 guests