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

RE: [amibroker] Re: Timer function which displya time on the chart itself. Refresh 60 sec?


  • To: <amibroker@xxxxxxxxxxxxxxx>
  • Subject: RE: [amibroker] Re: Timer function which displya time on the chart itself. Refresh 60 sec?
  • From: "Herman van den Bergen" <psytek@xxxxxxxx>
  • Date: Sat, 19 Feb 2005 05:08:39 -0500

PureBytes Links

Trading Reference Links

Perhaps ParamTrigger() is not in the latest offcial release... I always use the latest beta and unless I go through all the readMe files I do not know which functions are available in the official release. Almost every few weeks Tomasz adds new and important fuctions to the program. I am running AmiBroker 4.69.0 Feb 4 2005.
 
You could check the beta readme file on the -bet list to see what you are missing.
 
You could substitute the ParamToggle() for ParamTrigger() or use the Param(), like so:
 
Reset = Param("Set to 1 to Reset Static Variables",0,0,1,1);
 
The problem is that you have to remember to always reset this Param to zero. The ParamTrigger() is a very useful function that provides a execute-afl-one-time only option.
 
best regards,
herman.
-----Original Message-----
From: sinhavishal [mailto:sinhavishal@xxxxxxxxxxx]
Sent: Friday, February 18, 2005 7:38 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Timer function which displya time on the chart itself. Refresh 60 sec?


Hi,
Thanks a lot for your detailed response.
These are very good functions tin building this timer indicator.

When I put it in the indicator formula I get on the function
ParamTrigger an error.

In the help this function ParamTrigger is not mentioned? I could find
ParamStr, Param,ParamColor etc.

You mentioned click to reset. You mean only after clicking on the
chart it will refresh? Is it a way to get it rereshed timer
automatically at an interval.

Thanks in advance
Choco
--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen"
<psytek@xxxx> wrote:
> Here are some timer functions to give you ideas:
>
> Reset = ParamTrigger("Static Variables","Click to Reset");
>
> function GetSecondNum()
>       {
>       Time             = Now(4);
>       Seconds       = int(Time%100);
>       Minutes       = int(Time/100%100);
>       Hours       = int(Time/10000%100);
>       SecondNum= int(Hours*60*60+Minutes*60+Seconds);
>       return SecondNum;
>       }
>
> function GetElapsedSeconds( reset )
>       {
>       NowSecs       = GetSecondNum();
>       if( Reset ) StaticVarSet("SecondTimer", NowSecs );
>       PrevSecs = StaticVarGet("SecondTimer");
>       ESecs = NowSecs - PrevSecs;
>       return eSecs;
>       }
>
> function GetBarSecsLeft()
>       {
>       BarInterval      = Interval();
>       NowSecs       = GetSecondNum();
>       PrevSecs       = StaticVarGet("SecondTimer");
>       ESecs       = BarInterval - (NowSecs - PrevSecs);
>       if( eSecs < 0 ) eSecs = 0;
>       else if ( eSecs > 60 ) eSecs = 60;
>       return eSecs;
>       }
>
> if( IsEmpty(StaticVarGet("IsInitialized")) OR Reset)
>       {
>       StaticVarSet("PrevBarNum",      BarCount-1);
>       StaticVarSet("IsInitialized",1);
>       }
>
> Plot(C,"C",1,128);
>
> Title =
> "\nUse Param() to reset elapsed seconds..."+
> "\nSecond Count:     "+NumToStr(GetSecondNum(),1.0,False)+
> "\n20-Second Count:  "+NumToStr(int(GetSecondNum()/20),1.0,False)+
> "\nElapsed Seconds:  "+NumToStr(GetElapsedSeconds(Reset),1.0,False)+
> "\nBar Seconds left: "+NumToStr(GetBarSecsLeft(),1.0,False);
>
>
> -----Original Message-----
> From: sinhavishal [mailto:sinhavishal@xxxx]
> Sent: Friday, February 18, 2005 4:29 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Timer function which displya time on the chart
> itself. Refresh 60 sec?
>
>
>
> Any comments on this topic yet?
>
> --- In amibroker@xxxxxxxxxxxxxxx, "sinhavishal" <sinhavishal@xxxx>
wrote:
> >
> > Please comment on this code for any bugs or enhancements.
> > Thisdisplays time left for the current bar  to print on the chart
> itself.
> >
> > I have a problem in this code. The chart only refreshes at 60 seconds
> > interval and timer too. I would liek the timer to refresh every 20
> > seconds.
> >
> > I am using IB live data via the plugin. Database is setup for 15
> > seconds base interval and preferences to refresh the chart every 3
> > secs interval.
> >
> > Any help is ppreciated. Is this NOW(4) function refreshes only every 1
> > min??
> >
> > ====================
> > function TimeNumtoSec(hhmmss)
> > {
> > HHt = StrToNum(StrLeft(hhmmss,2));
> > MMt = StrToNum(StrMid(hhmmss,2,2));
> > SSt = StrToNum(StrRight(hhmmss,2));
> >
> > result = HHt*3600 + MMt*60 + SSt;
> > return result;
> > }
> >
> > z = CCI(14);
> > LSMA = LinearReg(C, 25 );
> > EMA34 = EMA(C,34);
> >
> > LastBarTime = TimeNumtoSec( NumToStr(Ref(TimeNum(),1)) ); //last
> > printed bar time in seconds
> > current = TimeNumtoSec( NumToStr(Now(4)) ); //current time in seconds
> > sofar = current - LastBarTime; //seconds elapsed since last
printed bar
> > SecondstoGo =  Interval() -
> >                ( sofar/Interval() - floor(sofar/Interval())
> >                )*Interval(); //seconds left for printing next
> interval bar
> >
> > TimeColor = IIf ( SecondstoGo > 21, colorLime,
> >          IIf ( SecondstoGo < 19, colorRed, colorBlack) );
> >
> > Title = Interval(2) + EncodeColor(colorOrange) + " " +
> >                   "CCI 14=" + round(z) + ", " +
> EncodeColor(colorLightBlue) +
> >                   "CCI 6=" + round(CCI(6)) +
> >                   EncodeColor(colorPink) + "\nPrice=" + H + ", " +
L + ",
> " + C +
> >                   EncodeColor(colorWhite) + "\n" + Date() + " " +
> > EncodeColor(TimeColor) + int(SecondstoGo) + " S";
> > ==============================
> >
> > Thanks
> > Choco
>
>
>
>
>
> 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 the Yahoo! Terms of Service.





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

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




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

Get unlimited calls to

U.S./Canada



Yahoo! Groups Links