Full Description
This function examines past value of the series and only changes value (or state) when:
- If currently ON (TRUE) then the off_value must be triggered
- If currently OFF (FALSE) the then on_value must be triggered
Triggering depends on the following
If on_value > off_value
- ON when series >= on_value
- OFF when series <= off_value
Otherwise if on_value < off_value
- ON when series <= on_value
- OFF when series >= off_value
Parameters:
series: see GetSeries("")
on_value,off_value: thresholds that trigger a state change
initial_state: values returned when no threshold is exceeded (default is TRUE)
Examples:
To only buy stocks when the % of stocks in the S&P 500 raises above 80% and go to cash when it dips below 25% enter this rule:
FlipFlop(GetSeries("%AboveSMA200-SP500"), 80, 25)
This rule uses a predefined custom series found in TOOLS->SERIES. You can find an example of a screen called "FlipFlop" that
buys SPY when ON and go to cash when OFF. It is located in the predefined screens in the Breadth category.