NexusFi: Find Your Edge


Home Menu

 





Dynamic array sum


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Fobos with 4 posts (0 thanks)
    2. looks_two ABCTG with 2 posts (1 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 iq200 with 1 posts (0 thanks)
    1. trending_up 3,634 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0

Help is needed. The code I wrote gives an error "ARRAY BOUNDS. WRONG INDEX VALUE: 73"
The logic is this, I summarize the volume when the volume begins to grow after the decline. I do the summation through a dynamic array, since in the future we will need the values of the first and last element in the array.
Tell me what could be the error.

 
Code
Variables:

sput (0),
var0( 0 ),
Times ( 0 ),
lastVol (0),
firstVol (0),
TimeSput (0),
x (0),
VolSum( 0 );

Arrays:
VolSumArray[](0);

begin

if BarType >= 2 and BarType < 5 then 
	
var0 = Volume ;
var0 = Ticks ;
	
	
If (var0 > var0[1]and var0[1] <= var0[2] ) then begin
sput = Close[1];
End;

If sput = sput then begin
TimeSput = datetime;
End;

If TimeSput > TimeSput [1] then
x=x+1;
Array_SetMaxIndex(VolSumArray, x );


If TimeSput > TimeSput [1] then begin
VolSumArray[x] = var0;
End;

If TimeSput = TimeSput  then begin
lastVol = var0;
End;

If TimeSput[1] = TimeSput[1]  then begin
firstVol = var0;
End;


If (var0 > var0[1]and var0[1] <= var0[2] ) then 
VolSum = 0;

VolSum = Array_Sum(VolSumArray, firstVol, lastVol);


if Close[0] > sput then


Plot1( VolSum, "VolUp",Blue ) ;
	
if Close[0] < sput then 

Plot2( VolSum, "VolDn",Red ) ;

Plot3( 0, "Zero", black);

End;


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
Fabrication or Framework? Irans Denied MOU Explains the …
Prediction Markets & Event Contracts
Beijing Summit Closes: Xi Pledges Hormuz Help -- $1.14B …
Prediction Markets & Event Contracts
CFTC Approves First US Bitcoin Perpetual Futures -- Kals …
Traders Hideout
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 iq200 
London, UK
 
Experience: Intermediate
Platform: Ninjatrader, Tradestation
Broker: Kinetick, InteractiveBrokers
Trading: Equities, Futures
Posts: 418 since Jun 2010
Thanks Given: 146
Thanks Received: 287


Why don’t you use the EasyLanguage debugger?

I haven’t used Tradestation Easylanguage for years since I moved to Ninjatrader but most likely, I’d check the arguments to Array_Sum to see they are valid. In particular, I think arrays are 0 index based which means start index will be 0 and last index will be n-1 (for array of size n elements).


Sent from my iPhone using NexusFi


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0


iq200 View Post
Why don’t you use the EasyLanguage debugger?

I haven’t used Tradestation Easylanguage for years since I moved to Ninjatrader but most likely, I’d check the arguments to Array_Sum to see they are valid. In particular, I think arrays are 0 index based which means start index will be 0 and last index will be n-1 (for array of size n elements).


Sent from my iPhone using NexusFi

Where can I find the EasyLanguage debugger?
As I understand it, in EasyLanguage Array indexes start at 0, and array size is equal to the value of MaxIndex plus one.


Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

Fobos,

the debugger is built-in into the development environment and you can find more information in the platform help. Alternatively you can use the print reserved word to find out what is going within your code.
Check the indices you are using within Array_Sum. From glancing at your code it's not guaranteed that you the array size >= lastVol.

Regards,

ABCTG


Fobos View Post
Where can I find the EasyLanguage debugger?
As I understand it, in EasyLanguage Array indexes start at 0, and array size is equal to the value of MaxIndex plus one.


Follow me on X Reply With Quote
Thanked by:
  #6 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0


ABCTG View Post
Fobos,

the debugger is built-in into the development environment and you can find more information in the platform help. Alternatively you can use the print reserved word to find out what is going within your code.
Check the indices you are using within Array_Sum. From glancing at your code it's not guaranteed that you the array size >= lastVol.

Regards,

ABCTG

Thank. I figured out the debugger using print. Before the onset of the condition, is it necessary / possible to reset the array, max index?


Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

Fobos,

not from an EasyLanguage point of view, but your logic might dictate something else of course.

Regards,

ABCTG


Fobos View Post
Thank. I figured out the debugger using print. Before the onset of the condition, is it necessary / possible to reset the array, max index?


Follow me on X Reply With Quote
  #8 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0


ABCTG View Post
Fobos,

not from an EasyLanguage point of view, but your logic might dictate something else of course.

Regards,

ABCTG

So I described the logic and code in the first post. And since the indicator gives an error, I ask for help. Thanks anyway!


Reply With Quote




Last Updated on October 14, 2019


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts