Does anyone have this AFL ?

KelvinHand

Well-Known Member
#21
:thumb:
There was a wrong leftover in the code. I have updated it. Please update the old code of your quote. Or just delete the whole quote.
Is there something wrong with this statement with %g using WriteIf?

bartimestr = WriteIf( bartime == 0, "-> Datafeed OFF ", "-> %g seconds left " );


OK. I see you cater it for the StrFormat().:thumb:
 

trash

Well-Known Member
#24
T
Its got somes like -.-1e+010 secods left any speciftic reason for that or is there any way to get rid of that as well n jus display the TF n time left
:)

Then your real-time source doesn't seem to be suitable for that lastbartimeleftrt modus. What's your source? It must be a streaming realtime plugin like IQFeed or Esignal etc. Don' think DDE works.

Then you would have to use "lastbartimeleft" and keeping your time up-to-date via time server. Or ask AmiBroker support.
 
#25
Then your real-time source doesn't seem to be suitable for that lastbartimeleftrt modus. What's your source? It must be a streaming realtime plugin like IQFeed or Esignal etc. Don' think DDE works.

Then you would have to use "lastbartimeleft" and keeping your time up-to-date via time server. Or ask AmiBroker support.
Its E-Signal
 

bend

New Member
#26
Try this
_SECTION_BEGIN("Time Left");
tempnum = Now( 4 ) - TimeNum();
TimeRem = Interval() - ((int(tempnum[BarCount - 1] / 100) * 60) + (tempnum[BarCount - 1] - int(tempnum[BarCount - 1] / 100) * 100));
if (TimeRem[BarCount - 1] < 0) TimeRem = 0;
MinuteVar = int(TimeRem / 60);
SecondsVar = int(frac(TimeRem / 60) * 60);
TitleTimeRem = EncodeColor(colorWhite) + MinuteVar + ":" + WriteIf(SecondsVar > 9, "", "0") + SecondsVar;
Hora=Param("Horizontal Positiona",525,1,1200,1);
Vera=Param("Vertical Positiona",17,1,830,1);
GfxSetBkMode( colorWhite );
FST=Param("Font Size Time",12,11,100,1);
GfxSelectFont( "Arial", FST, 700, italic = False, underline = False, True );
GfxSetTextColor(ParamColor("Color",colorWhite) );
GfxTextOut( ""+MinuteVar+":"+WriteIf(SecondsVar > 9, "","0")+SecondsVar+"", Hora+30 , Vera+65 );
_SECTION_END();
 

trash

Well-Known Member
#28
This one does the same but with less code.

It uses "lastbartimeleft" instead of "lastbartimeleftrt" since you had problems with latter one.

Code:
bartime    = Status( "lastbartimeleft" ); 
if ( bartime < 0 )
    MinuteVar  = SecondsVar = 0;
else
{
    MinuteVar  = int( bartime / 60 );
    SecondsVar = int( frac( bartime / 60 ) * 60 );
}

bartimestr = "%g:" + WriteIf( SecondsVar > 9, "", "0" ) + "%g"; 

SetChartOptions( 0, chartShowArrows | chartShowDates | chartWrapTitle ); 
_N(Title = StrFormat( "{{NAME}} - " + EncodeColor( colorRed ) + "{{INTERVAL}} -> " + bartimestr +
                      EncodeColor( colorDefault ) + " - {{DATE}} - O: %g, H: %g, L: %g, C: %g (%.2f%%)  {{VALUES}}", 
                      Minutevar, SecondsVar, O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
 
Last edited:

XRAY27

Well-Known Member
#29
_SECTION_BEGIN("Timer");
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;
}
RequestTimedRefresh( 1 );
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
TimeFrame = Interval();
SecNumber = GetSecondNum();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;

x=Param(" xposn",100,100,1000,1000);
y=Param(" yposn",0,40,1000,1);

GfxSelectSolidBrush( colorWhite );
GfxSelectPen( colorBlack, 2 );
if ( NewPeriod )
{
GfxSelectSolidBrush( colorBlack );
GfxSelectPen( colorBlack, 2 );
//Say( "New candle" );
}
GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 9, 700, False );
GfxSetTextColor( colorBlack );
GfxTextOut( "" +SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
_SECTION_END();
check this one
 
#30
This one does the same but with less code.

It uses "lastbartimeleft" instead of "lastbartimeleftrt" since you had problems with latter one.

Code:
bartime    = Status( "lastbartimeleft" ); 
if ( bartime < 0 )
    MinuteVar  = SecondsVar = 0;
else
{
    MinuteVar  = int( bartime / 60 );
    SecondsVar = int( frac( bartime / 60 ) * 60 );
}

bartimestr = "%g:" + WriteIf( SecondsVar > 9, "", "0" ) + "%g"; 

SetChartOptions( 0, chartShowArrows | chartShowDates | chartWrapTitle ); 
_N(Title = StrFormat( "{{NAME}} - " + EncodeColor( colorRed ) + "{{INTERVAL}} -> " + bartimestr +
                      EncodeColor( colorDefault ) + " - {{DATE}} - O: %g, H: %g, L: %g, C: %g (%.2f%%)  {{VALUES}}", 
                      Minutevar, SecondsVar, O, H, L, C, SelectedValue( ROC( C, 1 ) ) ) );
T
It coudnt get better, this is great stuff, n as we would say at the CME after a great trade merci beaucoup.
 

Similar threads