COCO研究院

 找回密碼
 註冊
搜索
查看: 1810|回復: 6

Amibroker chart searching

[複製鏈接]
發表於 14-6-7 18:32 來自手機 | 顯示全部樓層 |閱讀模式
大家好。請問有什麼方法可以令amibroker chart 可以用search function 之類跳去指定日期/時間?謝謝。
發表於 14-6-8 03:13 | 顯示全部樓層
From the AmiBroker forum

//zoom to date/time by fxshrat

procedure ZoomChart( Begindate, Enddate )
{
   AB = CreateObject("Broker.Application");
   AW = AB.ActiveWindow;
   AW.ZoomToRange( Begindate, Enddate );
}

EnableTextOutput( 0 );
MidZoomdate   = ParamDate( "Choose Date to search for", Now( 1 ), 0 );
MidZoomtime   = ParamTime( "Choose Time to search for", "12:00:00" );
tmfrmmode     = ParamList( "Choose Base Timeframe", "1-Second|1-Minute|5-Minute|10-Minute|15-Minute|30-Minute|Hourly|Daily|Weekly|Monthly", 7 );

switch( tmfrmmode )
{
    case "1-Second":  tmfrm = in1Second;    break;
    case "1-Minute":  tmfrm = in1Minute;    break;
    case "5-Minute":  tmfrm = in5Minute;    break;
    case "10-Minute": tmfrm = 2*in5Minute;  break;
    case "15-Minute": tmfrm = in15Minute;   break;
    case "30-Minute": tmfrm = 2*in15Minute; break;
    case "Hourly":    tmfrm = inHourly;     break;
    case "Daily":     tmfrm = inDaily;      break;
    case "Weekly":    tmfrm = inWeekly;     break;
    case "Monthly":   tmfrm = inMonthly;    break;
    default:          tmfrm = inDaily;      break;
}

barvalue = -1;

if( tmfrm < Interval() )
    tmfrm = Interval();
   
if( Interval() >= 86400 )
{
   MidZoomtime = 0;
   barvalue = -2;   
}

Midzoom   = DateTimeConvert( 2, Midzoomdate, MidZoomtime );
Beginzoom = DateTimeToStr( DateTimeAdd( Midzoom, barvalue, tmfrm ) );
Endzoom   = DateTimeToStr( DateTimeAdd( Midzoom, 1, tmfrm ) );
EnableTextOutput( 1 );

if( ParamTrigger( "Zoom?", "CLICK HERE" ) )
    ZoomChart( BeginZoom, EndZoom );

Plot( IIf( DateTime() == midzoom, BarIndex(), Null ), "", colorRed, styleHistogram | styleOwnScale, 0, 1, 0, -10, -10 );

 樓主| 發表於 14-6-8 10:18 | 顯示全部樓層
OH!!!...真的謝謝你....完全沒想過可以用AFL...
發表於 14-6-8 14:24 | 顯示全部樓層
joshsmi 發表於 14-6-8 03:13
From the AmiBroker forum

//zoom to date/time by fxshrat

thanks x 2. as said, never imagine it could be done by AFL......
發表於 14-6-8 15:36 | 顯示全部樓層
Anything can be done by AFL!
 樓主| 發表於 14-6-8 17:09 | 顯示全部樓層
不好意思,我想問一下我已經copy source save as AFL...how to call it out? 謝謝...
發表於 14-6-8 17:38 | 顯示全部樓層
Drag&drop on chart, CTRL+R, choose parameters, and click button "CLICK HERE"


instead of
if( ParamTrigger( "Zoom?", "CLICK HERE" ) )

you can also use
if( GetASyncKeyState( ... )  < 0 )

and/or mouse button functions
cmb        = GetCursorMouseButtons();
Lmouse    = cmb == 9;
etc.
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

手機版|Archiver|站長信箱|廣告洽詢|COCO研究院

GMT+8, 24-11-23 03:26

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回復 返回頂部 返回列表
理財討論網站 |