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

[amibroker] Help with minute/second counter in an indicator window???



PureBytes Links

Trading Reference Links

I want to have a minute/second counter in an indicator window... ie
so i can see how many seconds and or minutes (for longer time
frames) are left in the current bar I use 1 2 5 15 30 minutes and a
daily. I also want to be able to use this code for an entry at a
specified time before the bar closes... can anyone help modify the
timing function to get the display in the indicator and so i can use
that code to time an antry

1.i don't want to have to reset the elapsed seconds part below
2.i don't need to know how to get it in my indicator or how to set
up an entry at the specified time

Thanks in advance for any help

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);






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/