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

[amibroker] ZoomToRange() problem



PureBytes Links

Trading Reference Links



Hi,

I am translating an EOD trading system to the 1-Min Time-Frame, to add stops etc. To help me compare trades I use two AmiBroker Windows, the upper window displays the EOD system chart, with signal arrows. The Lower window contains my 1-Min system under development. In EOD I get about 20 two-day trades per year. While it is easy to find the trades on the upper EOD chart (only 600 bars) it is a real pain to find the matching trade in the lower 1-min window (requires scrolling through 250,000 bars).

What I need is to be able to click on a signal in the upper (EOD) chart and then automatically zoom the bottom chart to display ONLY the two-day period for the trade. I wrote some code that ought to work but somehow the upper window, even though it doesn't have a ZoomToRange() statement, also zooms to my two day range. This kind of spoils it all.

My question: When displaying two windows, is it possible to zoom (using ZoomToRange) ONLY the lower 1-Min window and leave the upper EOD unchanged?

I copy my test code below. If you feel like testing it creates a two-window display, apply the same code to both windows, set the upper Param to EOD, and the lower Param to 1-MIN.

many thanksfor any help anyone can give,
herman

RequestTimedRefresh(1);

if ( ParamToggle( "TimeFrame Window", "1 MIN|EOD", 0 ) )
{
    Plot(C,"",1,128);
    DT = DateTime();
    SDT = SelectedValue( DT );
    PrevDT = StaticVarGet( "DateTimeNumber" );

    if ( GetCursorXPosition( 1 ) AND SDT != PrevDT AND Interval() == inDaily )
    {
        StaticVarSet( "DateTimeNumber", SDT );
        Leftclick = GetCursorMouseButtons() == 9;
        StaticVarSet( "EODSignalBuyDT", SelectedValue( Ref( DT, -1 ) ) );
        StaticVarSet( "EODSignalSellDT", SelectedValue( Ref( DT, 1 ) ) );
    }

    EODSignalBuyDT = Nz( StaticVarGet( "EODSignalBuyDT" ) );
    EODSignalSellDT = Nz( StaticVarGet( "EODSignalSellDT" ) );
    Title = "\nEOD\n" + DateTimeToStr( EODSignalBuyDT ) + "\n" + DateTimeToStr( EODSignalSellDT ) ;
    }
else
    {
    Plot(C,"",1,128);
    PrevEODSignalBuyDT = Nz( StaticVarGet( "PrevEODSignalBuyDT" ) );
    EODSignalBuyDT = Nz( StaticVarGet( "EODSignalBuyDT" ) );
    EODSignalSellDT = Nz( StaticVarGet( "EODSignalSellDT" ) );

    test = ParamTrigger( "Test", "TEST" );
    if (  test AND Interval() == in1Minute )
    {
        Say( "zoom" );
        StaticVarSet( "PrevEODSignalBuyDT", EODSignalBuyDT );
        AB = CreateObject( "Broker.Application" );
        AW = AB.ActiveWindow;
        _TRACE( "BuyDT " + DateTimeToStr( EODSignalBuyDT ) + " SellDT" + DateTimeToStr( EODSignalSellDT ) );
        AW.ZoomToRange( DateTimeToStr( EODSignalBuyDT ), DateTimeToStr( EODSignalSellDT ) );
    }
    Title = "\n1 MIN\n" + DateTimeToStr( EODSignalBuyDT ) + "\n" + DateTimeToStr( EODSignalSellDT ) ;
}







__._,_.___


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

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

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___