Good Day!
Im looking forward to output a count of bars barssince()
when a reverse cumulation operation are reached: barssince( reverse(cum(volume)) >= 1000000 shares
but certainly Im doing something wrong:
What Im understanding till now is that a regular cum(array) function do something like this:
From array [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] cum(array) outputs: [ 0, 1, 3, 6, 10, 15, 21, 28, 36, 45]
Then I would like to perform a cum() but in the reverse direction, which shluld look like:
[45, 45, 44, 42, 39, 35, 30, 24, 17, 9]
From what I was reading in forums and other resources, and from my newbie perspective:
A) Do it with Amibroker’s Reverse() function: I was trying with this method but plotting the Reverse(cum(volume))
seems to do the calculations always from left to right (not right to left as I want) and only plot this in reverse order.
B) Take difference from total cum() and intercept value with barssince(): I think this method is the way to go, but I think I must deal with varset functions to make number static and I don’t want to make a mess in performance here. From my understanding, I need to create an array holding the difference of cum(volume) - staticSharesValue
in a static way in order to intercept the value with barsinsce()
function, but don’t find how to do it
C) Any other correct or better way to achieve this and Im still not aware of.
Thanks in advance.