Dear all,

How do I always display the first 100 bars by default when I go through the 
symbols via ALT + RIGHT/LEFT? I want to do this to carry a bar by bar exercise 
for pattern recognition training hence I want to start with the left side 
instead of the right.

I've tried the ZoomToIndex( FirstBarIndex, LastBarIndex) function given in 
http://www.amibroker.org/userkb/2007/06/28/zoom-to-range-applications/
but due to my limited knowledge in AFL I can only make it work in such a way 
that I have to click the "Apply Indicator" button every time when I change to 
the next ticker.

My AFL as followed - 

==================================================================
_SECTION_BEGIN("Price");
 
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | 
ParamStyle("Style") | GetPriceStyle() );

    FirstBarIndex =1;
    LastBarIndex =100;

    StaticVarSet( "FirstBarIndex", FirstBarIndex );
    StaticVarSet( "LastBarIndex", LastBarIndex );
    DT = DateTime();
    BI = BarIndex();
    LastDateTime = LastValue( ValueWhen( LastBarIndex == BI, DT ) );
    FirstDateTime = LastValue( ValueWhen( FirstBarIndex == BI, DT ) );
    LastDateTimestr = DateTimeToStr( LastDateTime );
    FirstDateTimestr = DateTimeToStr( FirstDateTime );
    AB = CreateObject( "Broker.Application" );
    AW = AB.ActiveWindow;
    AW.ZoomToRange( FirstDateTimestr, LastDateTimestr );

_SECTION_END();
==================================================================

Thanks in advance!

Warm regards,
Wang Fang

Reply via email to