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

Re: [trading] RE: [amibroker] Setting specific timespan



PureBytes Links

Trading Reference Links

Hello,

I think that Herman was answering different question.
Your question
> > 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

represents quite different problem that can be solved 

random_event_X = valuewhen(fubar,fubar), timenum());

180 minutes is 3 hours, so assuming that we do not cross day boundary 
this would be simply:

random_event_X = valuewhen(fubar,fubar), timenum());

timenum180minutes_back = random_event_X - 30000; // subtract 3 hours



Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Beachie" <beachie41@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, September 11, 2004 10:40 PM
Subject: Re: [trading] RE: [amibroker] Setting specific timespan


> Thanks, will try it out!.....though was hoping for the "simple" solution :)
> 
> cheers,
> ----- Original Message ----- 
> From: "Herman van den Bergen" <psytek@xxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Sunday, September 12, 2004 6:26 AM
> Subject: [trading] RE: [amibroker] Setting specific timespan
> 
> 
> > 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]
> > 
> > 
> > 
> > 
> > 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
> > 
> > 
> > 
> > 
> > 
> >
> 
> 
> 
> 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
> 
> 
> 
>  
> 
> 


------------------------ 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/