Help.How to get hours of current time?

Indicators coded by community members
Message
Author
martin.Z
Posts: 4
Joined: Sun Sep 09, 2012 4:21 am

Help.How to get hours of current time?

#1 Postby martin.Z » Fri Oct 12, 2012 11:19 pm

hello!我的想法是判断如果当前时间在10:00到21:00之间就执行某个指标,但是找不到相应的函数。如下这个是api中提供的范例,但是在Delphi 7中没有Hour这个函数,我现在写的代码是这个,但是加载到FT2后长时间无响应。我不是程序员,所以不是很理解问题出在什么地方。请看看可否帮忙,或者麻烦提供下正确的代码。非常感谢!
var
hh,mm,ss,ms: Word;

DecodeTime(TimeCurrent, hh, mm, ss, ms);
while ((hh>9) and (hh<22)) do
begin
.............
end;

------------------------------------------
以下是软件api中的范例。
Delphi
if Hour(TimeCurrent) <> 22 then …
Last edited by martin.Z on Fri Oct 19, 2012 10:45 pm, edited 1 time in total.

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#2 Postby FT Support » Sun Oct 14, 2012 7:45 am

Hello,

Sorry but we cannot read your post, in what language is it? Probably there are some troubles with encoding.
Check our other product here:
http://www.forexcopier.com

martin.Z
Posts: 4
Joined: Sun Sep 09, 2012 4:21 am

#3 Postby martin.Z » Fri Oct 19, 2012 10:38 pm

Sorry,I use the Chinese.

martin.Z
Posts: 4
Joined: Sun Sep 09, 2012 4:21 am

#4 Postby martin.Z » Fri Oct 19, 2012 10:43 pm

hello!
It is not the “Hour” this function in Delphi 7, how to get hours of current time?examples?
Thank you very much!

This api example is the old,Compile error。
-------
Delphi
function TimeCurrent: TDateTime;

Example:
Delphi
if Hour(TimeCurrent) <> 22 then …

KelvinHand
Posts: 103
Joined: Sun Jan 02, 2011 6:05 pm

#5 Postby KelvinHand » Sun Oct 21, 2012 12:49 am

martin.Z wrote:hello£¡
It is not the ¡°Hour¡± this function in Delphi 7, how to get hours of current time?examples?
Thank you very much£¡

This api example is the old£¬Compile error¡£
-------
Delphi
function TimeCurrent: TDateTime;

Example:
Delphi
if Hour(TimeCurrent) <> 22 then ¡­


use DateUtils;
if HourOf(TimeCurrent) <> 22 then ¡­
will not go to sleep
else
the same problem you faced was answered in the following
http://www.forextester.com/forum/viewto ... ght=hourof
:D

hi FT,
I can understand why Martin Z. facing this problem.
Look at your user guide, the mistake still not updated.
The HourOf function is used in the C++ not in the delphi.


Image


Return to “Indicators”

Who is online

Users browsing this forum: No registered users and 3 guests