Short Name: Reverse
Definition: Returns an array of values representing the opposite of the array passed as parameter
Usage: reverse(array)
Objective:
- Returns an array of values where the first value becomes the last one and the last value becomes the first one
- Returns an array of values.
Note:
- Sometimes, often in the case of cumulative indicators, you’ve to build a “For” loop starting with the oldest values
Examples:
- reverse(array), if array is 1,2,3, then returns 3,2,1
- OBV:
- leVol = reverse(volume)
- leClose = reverse(close)
- leClose1 = shiftedRight(leClose,1)
- test = leClose < leClose1
- accumulate(obv0,0)
- for(0,histoRange)
- if(var(test,0)) then
- dummyPlus = var(leVol,0) + var(obv0,0)
- accumulate(obv0,dummyPlus)
- else
- dummyMoins = 0 - var(leVol,0) + var(obv0,0)
- accumulate(obv0,dummyMoins)
- endif
- endfor
- notifyresult(reverse(obv0))