Functions applied to Arrays

Questions about MultiCharts and user contributed studies.
trader0311
Posts: 50
Joined: 28 Sep 2014
Has thanked: 7 times

Functions applied to Arrays

Postby trader0311 » 02 Oct 2015

I have created a dynamic array that looks at a running sequence of five values that meets a predetermined condition. When a value meets the condition, the new value comes in and the last value is removed from the array. I am able to use the "canned" array average function and successfully calculate the average of those five values. I now want to do a more sophisticated mathematical operation on those array values and there isn't a pre-written mathematical function available on the platform I am using. Do I have to create new function code for any sophisticated mathematical operation that I want to apply to the array values. Or, is there an easier way? Writing new code every time I want to creatively use math to evaluate the array values seems like an arduous task.

Is there some standard code that can be written and re-purposed if you do indeed need to rewrite every function before it can be applied to an array?

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Functions applied to Arrays

Postby Henry MultiСharts » 13 Oct 2015

Hello trader0311,

There are multiple prebuilt functions for array operations:
array_compare
array_contains
array_getmaxindex
array_copy
If you need additional functionality - you can create your own functions for it.


Return to “MultiCharts”