Hi guys,
I am having problems with results of the cum function.
The first is correct
The second is wrong
I added a setbarsrequired just to try and understand what is happening but doesn't help.
In the second the downchange value is correct but is not accumulated with the cum function. Even if the one value was the only one (it shouldn't be) it should at least be in the accumDownChange in the next statement.
I haven't posted the entire code at this stage as it is quite large and has a few #includes.
when dealing with arrays, use LastValue() to ensure you get the last value or select a specific index with [ ] so you know what you are comparing output with.
@nsm51 is correct, _TRACE() when passed an array acts a bit like SelectedValue(), we dont know if your 'downChange' array has a zero values.
Also note that if 'downChange' has Nulls (other than at the start) then Cum() will not be able to sum the full series. Perhaps try Cum( Nz( downChange ) ); to do a quick check.