vcqcjv 發表於 14-9-30 09:25

那位大大有AmiBroker显示K线剩余时间的代码?

那位大大有AmiBroker显示K线剩余时间的代码? 谢谢!

kilroy 發表於 14-9-30 09:46

看看這個可以嗎

_SECTION_BEGIN("Time Left");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",300,0,1000,1);y=Param("yposn",50,0,1000,1);GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );if ( NewPeriod ){GfxSelectSolidBrush( colorYellow );GfxSelectPen( colorYellow, 2 );Say( "New period" );}GfxRoundRect( x+45, y+17, x-3, y-2, 0, 0 );GfxSetBkMode(1);GfxSelectFont( "Arial", 12, 700, False );GfxSetTextColor( colorBlack );GfxTextOut( ""+SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );_SECTION_END();

keymaker 發表於 14-9-30 10:32

感謝分享............................................

vcqcjv 發表於 14-9-30 11:04

谢谢                        版主大大!

vcqcjv 發表於 14-10-1 10:26

版主大大能修改成   『小时:分:秒』   的格式吗?谢谢!

kilroy 發表於 14-10-1 22:44

vcqcjv 發表於 14-10-1 10:26 static/image/common/back.gif
版主大大能修改成   『小时:分:秒』   的格式吗?谢谢!

試試看這個吧
_SECTION_BEGIN("Time Left");
tempnum = Now( 4 ) - TimeNum();
TimeRem = Interval() - ((int(tempnum / 100) * 60) + (tempnum - int(tempnum / 100) * 100));
if (TimeRem < 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();




不過"小時"沒辦法倒數

我不會 {:4_624:}

vcqcjv 發表於 14-10-2 08:59

谢谢版主大大    这个不会动显示0:00

kilroy 發表於 14-10-2 09:06

vcqcjv 發表於 14-10-2 08:59 static/image/common/back.gif
谢谢版主大大    这个不会动显示0:00

只能用分(鐘)線才會動 {:4_103:}

vcqcjv 發表於 14-10-3 06:57

谢谢               版主大大
頁: [1]
查看完整版本: 那位大大有AmiBroker显示K线剩余时间的代码?