[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Setting specific timespan



PureBytes Links

Trading Reference Links

AmiBroker doesn't have any Timer functions, however you can read the time
using Now(4) and use StaticVariables to keep a record of what happend when.
Belwo some demo code you can play with..

herman


----------------------------------------------------------------------------
----


function SecondNum()
{
Time = Now(4);
Seconds = int(Time%100);
Minutes = int(Time/100%100);
Hours = int(Time/10000%100);
SecondCount= int(Hours*60*60+Minutes*60+Seconds);
return SecondCount;
}


E = Param("Event",0,0,1,1);
PrevE = StaticVarGet("Event");
StaticVarSet("Event",E);
if( E == 0 AND (E != PrevE))
StaticVarSet("TimeEvent1",LastValue(SecondNum()));
if( E == 1 AND (E != PrevE))
StaticVarSet("TimeEvent2",LastValue(SecondNum()));
Event1Seconds = StaticVarGet("TimeEvent1");
Event2Seconds = StaticVarGet("TimeEvent2");
Title =
"\nEvent0Seconds= "+NumToStr(Event1Seconds,1.0,False)+
"\nEvent1Seconds= "+NumToStr(Event2Seconds,1.0,False);


----------------------------------------------------------------------------
----




-----Original Message-----
From: Beachie [mailto:beachie41@xxxxxxxxxxx]
Sent: Saturday, September 11, 2004 2:28 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Setting specific timespan


Hi all,
how do I go about testing to see if X amount of minutes has passed between a
random event?
i.e  random_event_X = valuewhen(fubar,fubar), timenum());
Now I want to look back to see if  "XYZ_event"  occured within 180min of the
last
"random_event_X"
Do I have to use convulted code or is there a simple solution?
Thanks.



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html


Yahoo! Groups Sponsor
ADVERTISEMENT






Yahoo! Groups Links

To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/

To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/