哪位大大可指点一下多个AB窗口的问题
由于AB没有提供指定日期跳转功能。一直使用以下AFL做日期跳转,但发现如果启动多个amibroker。那么,该AFL只对第一个有效,以后启动的怎么点图表都不会动。
是不是以下VBA call导致只能识别内存中的第一个打开的Ami呢?
AB = CreateObject( "Broker.Application" );
AW = AB.ActiveWindow;
AW.ZoomToRange( BeginZoom, EndZoom);
AFL如下:
sDateStr = ParamStr("Goto example 2010/3/24 12:00:00", "");
bGoNow = ParamTrigger("Click Button to Go", "Click Here");
// require all bars, otherwise the index will not be correct
SetBarsRequired(-2, -2);
procedure ZoomChart(BeginZoom, EndZoom) {
AB = CreateObject( "Broker.Application" );
AW = AB.ActiveWindow;
AW.ZoomToRange( BeginZoom, EndZoom);
}
if(bGoNow AND StrLen(sDateStr) > 0) {
// Retrieve current indexes for visible bars
FirstBarIndex = Status( "firstvisiblebarindex" );
LastBarIndex = Status( "lastvisiblebarindex" );
nHalfScrRange = round( abs(LastBarIndex - FirstBarIndex) / 2);
DT = DateTime();
sDateStr = StrToUpper(sDateStr);
TargetMidBarIndex = 0;
for(i = 1; i < BarCount; i++) {
if (StrFind(DateTimeToStr(DT), sDateStr) > 0) {
TargetMidBarIndex = i;
break;
}
}
if(TargetMidBarIndex > 0) {
// cap the bar index if it goes beyond BarCount
if (TargetMidBarIndex + nHalfScrRange > BarCount) {
BeginZoom = DateTimeToStr(DT);
EndZoom = DateTimeToStr(DT);
}
else {
BeginZoom = DateTimeToStr(DT);
EndZoom = DateTimeToStr(DT);
}
// zoom to specified range
ZoomChart(BeginZoom, EndZoom);
// draw up/down triangle to highlight the identified bar
shapeArr = shapeUpTriangle;
PlotShapes(shapeArr, colorYellow, 0, Low, -12);
shapeArr = shapeDownTriangle;
PlotShapes(shapeArr, colorYellow, 0, High, -12);
}
}
_SECTION_END(); 這個太專業了~ {:4_113:} 在海洋部落看過人家寫的日期跳轉
但似乎沒提到多個Amibroker Instance的這種問題
這個可能要實際用過的人,才能查問題何在了
頁:
[1]