Is b ever > barCount-1?

BR,
Dennis


On Mar 8, 2009, at 2:44 PM, murthysuresh wrote:

> 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] ) );
>
>        }
>
>    }
> }

Reply via email to