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
hour
-
- Posts: 5
- Joined: Mon Oct 08, 2007 4:53 am
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
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
- Tantalus
- Posts: 302
- Joined: Fri Mar 23, 2007 3:51 pm
- Contact:
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"
- Terranin
- Site Admin
- Posts: 833
- Joined: Sat Oct 21, 2006 4:39 pm
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: Select all
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
Mike
Who is online
Users browsing this forum: No registered users and 18 guests