Accumulate
 

Short Name: Accumulate

Definition: In a for loop, accumulate data, either days to signal buy/sell or values

Usage: Accumulate(variable array,value)

Objective:
  • Used in a For loop, to accumulate intermediate values in an array
  • A new variable can be defined with Accumulate
  • The variable, passed as first parameter, is an array.
  • The second parameter can be a value or an array

Note:
  • Does not return anything

Examples:
  • 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))