I appreciate any help!
For a bigger project (combining multiple indicators), I need to be able to reference a long or short signal in an indicator from an prior time. The signal is a cross of a momentum indicator (such as RSI or MoneyFlowIndex) from above Overbought to below the Overbought line, or from below Oversold to back above Oversold. So the value of the indicator in both cases is between the Overbought and Oversold lines, and the only "identifier" that it's long or short is which direction it most recently crossed.
The time from the prior signal is always changing, so I can't tell it to look back a certain number of periods. I can't find any logic in ThinkScript to tell it to look for the most recent signal.
Any thoughts on how to make a clean way to do this? The logic is easy if "long" is only when it's oversold, but I can't seem to find any logic to define "long" as the entire time after crossing above oversold but not yet having gone above overbought.
Another way of thinking of this: I want the indicator to have a value of long or short, that stays that value until the opposite signal is registered.
Reason: I want to reference other momentum indicators as being long or short in a combined indicator.
Thanks in advance!
For a bigger project (combining multiple indicators), I need to be able to reference a long or short signal in an indicator from an prior time. The signal is a cross of a momentum indicator (such as RSI or MoneyFlowIndex) from above Overbought to below the Overbought line, or from below Oversold to back above Oversold. So the value of the indicator in both cases is between the Overbought and Oversold lines, and the only "identifier" that it's long or short is which direction it most recently crossed.
The time from the prior signal is always changing, so I can't tell it to look back a certain number of periods. I can't find any logic in ThinkScript to tell it to look for the most recent signal.
Any thoughts on how to make a clean way to do this? The logic is easy if "long" is only when it's oversold, but I can't seem to find any logic to define "long" as the entire time after crossing above oversold but not yet having gone above overbought.
Another way of thinking of this: I want the indicator to have a value of long or short, that stays that value until the opposite signal is registered.
Reason: I want to reference other momentum indicators as being long or short in a combined indicator.
Thanks in advance!