CCI(Period) as Array

CCI function returns an array containing the Commodity Channel Index indicator of the select period.

 

This function has one parameter:
Period   Enter the period to calculate the CCI.

 

Example:

' This system is based on Commodity Channel Index
Sub Main()
  TArr = CCI(10)
  For CurrentBar = BeginBar + 1 to EndBar
    If (TArr(CurrentBar) > -100) and (TArr(CurrentBar - 1) < -100) then Buy(CurrentBar)
    If (TArr(CurrentBar) < 100) and (TArr(CurrentBar - 1) > 100) then Sell(CurrentBar)
  Next
End Sub