I have scripted an indicator which is working perfectly. I would like to add an arrow to the price using the ShowBar tool when the indicator crosses above 60 only after it crosses below 40. I cant seem to get this to work. Please help . Thank you.
I don’t have the presaved scripts you are referring to in your code, so can’t show you a fully edited version, but the last line should be using SignalAfter() rather than Switch()
Thank you Mathew. This works perfectly. In a watchlist I want to count the number of bars since this signal occurred. Here is the script I have, but the watchlist does not show any values at all? Please see the screenshot.
//Define Signals
S1 = SCRIPT(SCRIPTNAME=StochClose 125 5) CrossesAbove 60 ;
S2 = SCRIPT(SCRIPTNAME=StochClose 125 5) CrossesBelow 40 ;
//Find The Last Signal
V1 = SignalAfter(S2,S1) ;
//Calculate # Of Bars Since Signal
TIMESINCESIGNAL(V1)