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

[amibroker] Error 10. Subscript out of range. You must not access array elements outside 0..



PureBytes Links

Trading Reference Links

i get the error when ther is white space on the right hand side as seen in this link.
http://screencast.com/t/sxLi3oR8

however my code seems to only loop between the fistvisible bar and lastvisiblebar. so i dont see why i should get a subscript out of range error. when i scroll the chart to the right and if there is no white space, the error disapprears.
appreciate any help

StaticVarSetText( "TradeType" , "Stocks" );  //Stocks|Forex
StaticVarSetText( "forexSymbol" , "PVTB" ); //"EUR.USD-IDEALPRO-CASH|
StaticVarSetText( "StockSymbol", "PVTB" ); //  "YHOO"
StaticVarSetText( "ShortOrLong" , "Short" );  //"Short|Long"
StaticVarSetText( "EntryPrice" , "11.90000,11.90000" );
StaticVarSetText( "ExitPrice" , "10.45000,10.45000" );
StaticVarSetText( "EntryDate" , "1090303,1090303" );
StaticVarSetText( "ExitDate" , "1090304,1090304" );
StaticVarSetText( "EntryTime" , "95126,95126" );
StaticVarSetText( "ExitTime" , "141019,141019" );
StaticVarSet( "NoOfEntries" , 2 );
StaticVarSet( "NoOfExits" , 2 );
StaticVarSet( "Tradeid" , 1017 );
StaticVarSetText( "TradeComments" , "" );
StaticVarSetText( "TradeStrategy" , "" );


dn = DateNum();

tn = TimeNum();


firstVisibleBar = Status( "firstvisiblebar" );
lastVisibleBar = Status( "lastvisiblebar" );

for ( b = firstVisibleBar;b < lastVisibleBar ;b++ )

{
    // START OF DAILY

    for ( i = 0 ;i <2;i++ )
    {
        // _TRACE( "ABTest: test 182 " + "matchig dn " + NumToStr( dn[b] ) );
        //  _TRACE( "ABTest: test 182 " + i );
        EntryDatei = VarGet( "EntryDate"  + i ) ;

        if ( ( EntryDatei  >	dn[b] - 1 )  AND ( EntryDatei < dn[b] + 1	 ) AND ( b < lastVisibleBar )  )
        {

            entryPrices[b] = VarGet( "EntryPrice" + i );
            Buy[b] = Short[b] = True;
            //_TRACE( "ABTest: test 182 matching price " + NumToStr( VarGet( "EntryPrice" + i ) ) ) ;
            // _TRACE( "ABTest: test 182 matching price " + NumToStr( VarGet( "EntryPrice" + i ) ) ) ;



            PlotText( ShortOrLong  +  " entry " + i + " " + ":" + entryPrices[b]   , b, ( yHigh + High[b] ) / 2, colorBlue );
            PlotText( "entry" + entryPrices[b]  , b, EntryPrice0, colorBlue );

            //  _TRACE( "ABTest: test 182 MATCHED " + NumToStr( VarGet( "EntryDate" + i ) ) + NumToStr( dn[b] ) );

        }

    }
}



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

**** 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/

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/