[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: run to cursor



PureBytes Links

Trading Reference Links

something is incorrect either on myunderstanding of selectedvalue or 
it does not behave correctly. basically if the cursor is not within 
the visible range, it seems to return the last barindex of the 
visible bars.

i have a work around here which only works on a intraday chart. 
basically you can double click on the chart to create  a green 
beginvalue marker. then you can change the resolution to any lower 
resolution interval like 15 minute or 5 minute and click on the 
Run2FocusTrigger and it will actually scroll the window to the green 
marker.
i dunno why it does not go from lower resolution to higher.

_SECTION_BEGIN("runToCursor");
SetBarsRequired( sbrAll,sbrAll);

procedure ZoomToIndex( FirstBarIndex, LastBarIndex )
{
    StaticVarSet( "FirstBarIndex", FirstBarIndex );
    StaticVarSet( "LastBarIndex", LastBarIndex );
	LastVisiblebar = Status( "LastVisibleBar" );
    FirstVisibleBar= Status( "FirstVisibleBar" );
range =LastVisiblebar - FirstVisibleBar;
_TRACE("range " + NumToStr(range));


    DT = DateTime();
    BI = BarIndex();
_TRACE(" FirstBarIndex " + NumToStr(FirstBarIndex) +  " 
LastBarIndex " + NumToStr(LastBarIndex));
    LastDateTime = LastValue( ValueWhen( round
((FirstBarIndex+range/2)) == BI, DT ) );
    FirstDateTime = LastValue( ValueWhen( round((FirstBarIndex-
range/2)) == BI, DT ) );
_TRACE("last date time" + NumToStr( LastDateTime));
    LastDateTimestr = DateTimeToStr( LastDateTime );
    FirstDateTimestr = DateTimeToStr( FirstDateTime );
_TRACE("LastDateTimestr" + LastDateTimestr +  "  FirstDateTimestr " 
+  FirstDateTimestr);
    AB = CreateObject( "Broker.Application" );
    AW = AB.ActiveWindow;
    AW.ZoomToRange( FirstDateTimestr, LastDateTimestr );
}
Run2FocusTrigger = ParamTrigger( "Run to Cursor", "Run" );// zoom out 
by ZoomIncrement

    if ( Run2FocusTrigger ){
      

_TRACE(NumToStr(SBI));
ZoomToIndex(BeginValue( BarIndex() ), EndValue( BarIndex() ) );





}
_SECTION_END();



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/