Forex Tester Forum (Professional Training Software for Traders) Forum Index Forex Tester Forum (Professional Training Software for Traders)

Back to main site   Risk disclosure
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

hour

 
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> Indicators
View previous topic :: View next topic  
Author Message
allan21



Joined: 08 Oct 2007
Posts: 5

PostPosted: Fri Dec 28, 2007 10:25 am    Post subject: hour Reply with quote

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
View user's profile Send private message
allan21



Joined: 08 Oct 2007
Posts: 5

PostPosted: Fri Dec 28, 2007 12:38 pm    Post subject: hour Reply with quote

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
View user's profile Send private message
Tantalus



Joined: 23 Mar 2007
Posts: 300

PostPosted: Fri Dec 28, 2007 3:52 pm    Post subject: Re: hour Reply with quote

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
View user's profile Send private message Visit poster's website
Terranin
Site Admin


Joined: 21 Oct 2006
Posts: 831

PostPosted: Fri Dec 28, 2007 7:42 pm    Post subject: Re: hour Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Forex Tester Forum (Professional Training Software for Traders) Forum Index -> Indicators All times are GMT
Page 1 of 1

 
Jump to:  
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