wrong default code for the function SummationArray

Questions about MultiCharts and user contributed studies.
User avatar
siscop
Posts: 197
Joined: 09 Jan 2011
Has thanked: 34 times
Been thanked: 29 times

wrong default code for the function SummationArray

Postby siscop » 04 Oct 2015

Code: Select all

inputs:
PriceValueArray[MaxSize]( numericarray ),
Size( numericsimple ) ;

variables:
var0( 0 ) ;

var0 = 0 ;
for Value1 = 1 to Size
begin
var0 = var0 + PriceValueArray[Value1] ;
end ;

SummationArray = var0 ;
This is the code for the function SumationArray which is per default in your system.
An Array starts at „0“ and not at „1“.
You can clearly see the „for- command” for the index of the array starts at „1“ which results on an delay of all following calling code of this function to be delayed one bar.

I noticed this since the function AverageArray keept on having a bar delay compared to its counterpart Average.

User avatar
siscop
Posts: 197
Joined: 09 Jan 2011
Has thanked: 34 times
Been thanked: 29 times

Re: wrong default code for the function SummationArray

Postby siscop » 05 Oct 2015

You can always change the loop to start at the point that suits you best.
I took a look inside the manual and it said that the normal array starts with "0".
I tried to change the code and the function is protected. I ended up copying and creating a new function including all required calling function to this one.

A numericseries is nothing else as an numericsimple with an array that is not changable as i understand and that also starts with "0".
Everytime you write "c" this is nothing else then "c [0]" so why change this in arrays?
I do understand your statement but in every computer language it starts with "0" and and a coder is used to use it that way.
I know we are traders but we are using codes to do that and this is off.

At least remove the protection.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: wrong default code for the function SummationArray

Postby TJ » 05 Oct 2015

Sorry I must have remembered wrong and mixed up with another programming.
(I have deleted my post to avoid confusion)


The preloaded functions in MultiCharts are protected.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: wrong default code for the function SummationArray

Postby TJ » 05 Oct 2015

Here they are... These are TS definitions.
I cannot locate similar texts in MultiCharts documents, but keywords and functions work the same as TS.

Arrays in EasyLanguage start at data element 0, however, all built-in functions that operate on arrays ignore the zero element, so it is advised not to use the zero element.

All array-based referencing begins with array element 1.


Return to “MultiCharts”