Cross(Array1, Array2) as Boolean OR Cross(Array, Name) as Boolean OR Cross(Name, Name) as Boolean

Cross returns True if first parameter (it can be an array or the string name of an existing indicator!) crosses ABOVE the second parameter!

 

This function has three parameters:
Array   An array, no matter the size.
Name   The name of an existing indicator
Place   The place where the crossing is tested. (Tested on Place and Place-1)
Here is how it works mathematically: Return True if (1stParam(t-1) < 2ndParam(t-1)) AND (1stParam(t) >= 2ndParam(t))

 

Example:

' This is a system
Sub Main()
 RSIind = RSI(14)
 RSIma = SMA(RSI(14), 10) ' 10 is the period of the average, 14 the RSI's period
 For CurrentBar = BeginBar to EndBar
  If Cross(RSIma, RSIind, CurrentBar) then Buy(CurrentBar)
  If Cross(RSIind, RSIma, CurrentBar) then Sell(CurrentBar)
 Next
End Sub