| View previous topic :: View next topic |
| Author |
Message |
allan21
Joined: 08 Oct 2007 Posts: 5
|
Posted: Fri Dec 28, 2007 10:25 am Post subject: hour |
|
|
Hi,
I am trying to use the following condition:
if Hour (Time(0)) <> 20 then
but when I compile the code I get the following error:
Undeclared Identifier Hour.
How can I resolve this issue?
Thanks |
|
| Back to top |
|
 |
allan21
Joined: 08 Oct 2007 Posts: 5
|
Posted: Fri Dec 28, 2007 12:38 pm Post subject: hour |
|
|
Hi,
there's another issue that I'd like to address, every time I process single tick procedure, all the paramters used in this procedure are reset to zero.
What I'd like to have is be able to remember the time of the previous tick and if the coming tick is within the same hour, I don't want to process it.
I can't do that cause if I use for example time1 := iTime('EURUSD', PERIOD_H1, 0), everytime I run singletick, time1 is reset to zero.
In brief, I need to tun single tick once for one hour candle only, not once for every tick.
How can I do that?
Thank you |
|
| Back to top |
|
 |
Tantalus

Joined: 23 Mar 2007 Posts: 300
|
Posted: Fri Dec 28, 2007 3:52 pm Post subject: Re: hour |
|
|
| allan21 wrote: | Hi,
I am trying to use the following condition:
if Hour (Time(0)) <> 20 then
but when I compile the code I get the following error:
Undeclared Identifier Hour.
How can I resolve this issue?
Thanks |
Assuming you're working in Delphi:
The function you are looking for is HourOf(), and it's located in the DateUtils library. Declare it where you declare the other API libraries:
uses
SysUtils, DateUtils, StrategyInterfaceUnit; {you may have different files listed}
Look in the Delphi help file under "HourOf" or "DateUtils" |
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Fri Dec 28, 2007 7:42 pm Post subject: Re: hour |
|
|
| allan21 wrote: | Hi,
there's another issue that I'd like to address, every time I process single tick procedure, all the paramters used in this procedure are reset to zero.
What I'd like to have is be able to remember the time of the previous tick and if the coming tick is within the same hour, I don't want to process it.
I can't do that cause if I use for example time1 := iTime('EURUSD', PERIOD_H1, 0), everytime I run singletick, time1 is reset to zero.
In brief, I need to tun single tick once for one hour candle only, not once for every tick.
How can I do that?
Thank you |
In this case you should move this variable out of procedure:
| Code: | var
LastTime: TDateTime;
procedure GetSingleTick; stdcall;
begin
SetCurrencyAndTimeFrame(Currency, PERIOD_M...);
if Time(0) = LastTime then
exit;
LastTime := Time(0);
...
end; |
_________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|