Category
General-Purpose Functions
Description
Compares two values for two bars to see if their ranking has changed
Syntax
Cross(value1, value2)
Parameters
value1 - formula related to bar data
value2 - formula related to bar data
Notes
This function is a shortcut for the expression value1[1] < value2[1] and value1 > value2.
It is most commonly used to compare two moving averages, or price to a moving average, e.g. Cross(MA(C,5), MA(C,20)) would return 1 (true) if the 5-day average was below the 20-day average yesterday and is above it today.
Logically, Cross(A,B) means "A has crossed above B". To test for "A has crossed below B", simply use Cross(B,A).
|