Skip to content

Quick-tip 30 | With IntrabarOrderGeneration set to true, get dynamic array index is out of bounds error

A Markplex subscriber has purchased one of the Markplex indicators and converted it into a strategy. All seemed to be working well until he set IntrabarOrderGenerationto true. He then received a dynamic array index is out of bounds error.

Quick-tip 30 explains why the error occurred and how to correct it.

Video explanation

{ THIS STRATEGY IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES,
DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE
OF THIS INFORMATION IS AT YOUR OWN RISK. THIS STRATEGY AND ASSOCIATED TECHNIQUES IS AN EXAMPLE ONLY, AND HAS BEEN INCLUDED SOLELY FOR
EDUCATIONAL PURPOSES. MARKPLEX CORPORATION DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, INDICATORS, SHOWME STUDIES,
PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF THIS
STRATEGY DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.}

[IntrabarOrderGeneration = FALSE];

Array: double MyArray[]( 0 );

Once // The following begin-end block will only be executed once
Begin
Array_SetMaxIndex( MyArray, 10 ) ; // Set the size of the Dynamic array to be equal to 10
ClearPrintLog; // Clear the print log
End;

Print( D, T, " Max index of MyArray ", Array_GetMaxIndex( MyArray ), " MyArray[10] ",MyArray[10] );

// Example trade
If Condition1 then Buy ( "Example entry" ) next bar at market ;

{ ** Copyright (c) 2019 Markplex Corporation. All rights reserved. **
** Markplex Corporation reserves the right to modify or overwrite this analysis technique
on its https://markplex.com Web site. ** }