COG(Period) as Array

COG function returns an array containing the Center of Gravity indicator of the select period.

 

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

 

Example:

' This system is based on Center of Gravity indicator
Sub Main()
  TArr = COG(10)
  For CurrentBar = BeginBar + 2 to EndBar
    If (TArr(CurrentBar) > TArr(CurrentBar - 1)) and (TArr(CurrentBar - 1) <= TArr(CurrentBar - 2)) then Buy(CurrentBar)
    If (TArr(CurrentBar) < TArr(CurrentBar - 1)) and (TArr(CurrentBar - 1) >= TArr(CurrentBar - 2)) then Sell(CurrentBar)
  Next
End Sub