免費論壇 繁體 | 簡體
公告:SCLUB雲端專屬主機己開放租用
分享
MT4程式(Program)專業代寫服務(請email:letgofortrading@gmail.com) 警告:文章內容可能有大便,不喜請勿入。請不要像動物一樣,不歡迎也請勿自行進來找碴和找大便。私人網頁,後果請自行負責~
返回列表 發帖

AmiBroker显示K线剩余时间的代码

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

修改成   『小时:分:秒』   的格式

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

不過"小時"沒辦法倒數

只能用分(鐘)線才會動
!qqconnect:connect_viewthread_share_title!: !qqconnect:connect_viewthread_share_to_qzone!!qqconnect:connect_viewthread_share_to_qzone! !qqconnect:connect_viewthread_share_to_weibo!!qqconnect:connect_viewthread_share_to_weibo! !qqconnect:connect_viewthread_share_to_pengyou!!qqconnect:connect_viewthread_share_to_pengyou!
LMAX 顛覆外匯交易經驗/擊敗所有外匯經紀商

返回列表