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

[amibroker] Re: Bar CountdownTimer



PureBytes Links

Trading Reference Links

Got it sorted out thanx ..

Needed to change interval calc as follows: 
nextbar = thisbar+(Interval()/36*100);   (Replace 60 with 36)


Cheers 


Dean H.


--- In amibroker@xxxxxxxxxxxxxxx, "troll" <deanhodgins@xxxx> wrote:
>
> I recently found this function (compliments of "hoolee0820" I 
believe 
> with many thanks for sharing)
> 
> Code works fine except for fact that on hourly bars countdown 
> progresses normally until 30 minutes left in bar and then function 
> returns "Timer: 00:00" Not sure why timer only works on first 30 
> minutes - perhaps code is set to accept 30 minute bars as maximum.
> 
> I've tried various permutations with no success so any suggestions 
> would be most welcomed.
>  
> function CountDownTimer( ) 
>    { 
>    //  CountDown Timer 
>    thisbar = TimeNum(); 
>    nextbar = thisbar+(Interval()/60*100); 
>    systime = Now(4); //pt time zone 
>    systime = IIf(systime>=240000,systime-240000,systime); 
>    anewbar = nextbar-systime-40; 
>    anewbar = IIf(anewbar<0,0,anewbar ); 
>    nnewbar = LastValue(anewbar); 
>     
>    if (nnewbar > 20) timercode = EncodeColor(colorBlue); 
>    else timercode = EncodeColor(colorRed); 
> 
>    anewbar= NumToStr(anewbar,1,False); 
>    length=StrLen(anewbar); 
> 
>    if (length== 1) timercode=timercode + "00:0" + anewbar; 
>    else if (length== 2) timercode=timercode +  "00:" + anewbar; 
>    else if (length== 3) timercode= timercode +  "0"+ StrLeft( 
anewbar, 
> 1) + ":" + StrRight( anewbar, 2) ; 
>    else if (length== 4) timercode= timercode +  StrLeft( anewbar, 
2) 
> + ":" + StrRight( anewbar, 2) ; 
>    else timercode=timercode +  "00:00"; 
> 
>    timercode= EncodeColor(colorBlack) + "  Timer: " + timercode; 
>    return timercode; 
>    }
> 
> Regards to all ..
> 
> 
> Dean H.
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/