Note: You state you are working on a “Strategy” yet you have posted this question under the “Chart Studies” topic. Let me know if this needs to be moved to the “Strategy Guide” topic.
Lacking a screenshot, or an example of the code you are building, I have to take a stab at this and hope I am close to understanding your question. It seems like you want to incorporate the behavior of RSICrossover into your strategy. The RSICrossover is a built-in study provided by Thinkorswim. Have you taken a look at the code for that study? It has an input called ‘threshold’. It has another input called ‘crossingType’. You should be able to copy and paste this into whatever code you are building and then simply set the parameters as needed. Then you have a plot called ‘signal’. This is a true/false condition that you can plug into your AddOrder() statement to block orders if signal == true. (AddOrder assumes you are working on a Strategy and not a Study).
For reference, I have included the original code from the RSICrossover built in study:
#
# TD Ameritrade IP Company, Inc. (c) 2009-2016
#
#wizard text: RSI crosses
#wizard input: crossingType
#wizard input: threshold
#wizard text: Inputs: length:
#wizard input: length
#wizard text: average type:
#wizard input: averageType
input length = 14;
input crossingType = {default above, below};
input threshold = 30;
input averageType = AverageType.WILDERS;
plot signal = crosses(RSI(length=length, averageType=averageType).RSI, threshold, crossingType == CrossingType.above);
signal.DefineColor(“Above”, GetColor(7));
signal.DefineColor(“Below”, GetColor(8));
signal.AssignValueColor(if crossingType == CrossingType.above then signal.color(“Above”) else signal.color(“Below”));
signal.SetPaintingStrategy(if crossingType == CrossingType.above
then PaintingStrategy.BOOLEAN_ARROW_UP
else PaintingStrategy.BOOLEAN_ARROW_DOWN);
I have found with the TOS system you can only have one crossing type in one script. So you would have to add a second rsi cross over study and select cross over type to below and adjust the threshold value to 70. 70 is considered
to be overbought. But don’t act on that signal alone as you would want to look for a divergence. You can also use
a reversal oscillator for confirmation like the fisher transform. I hope that helps reach your trade idea goal. Kevin