RSITrend on Watchlist


Category:
0
0

Hi Pete, I’m interested to have one of the default strategies of Thinkorswim named “RSITrend” on my watch list. I have attempted to create this based on the video I have found, but it was challenging as there are two “sell” condition (RSI_LX and TrendLX).

I am trying to set the plot showing 1 when RSI_LE is triggered and 0 when either RSI_LX or TrendLX is hit. The original strategies thinkScript is as below.

#
# TD Ameritrade IP Company, Inc. (c) 2016-2018
#

input price = close;
input length = 14;
input overBought = 70;
input overSold = 50;
input percentageReversal = 20.0;
input averageType = AverageType.WILDERS;

def rsi = reference RSI(price = price, length = length, averageType = averageType);
def trend = reference ZigZagTrendPercent(price = price, “reversal amount” = percentageReversal);

AddOrder(OrderType.BUY_AUTO, rsi crosses above overSold and trend == 1, tickColor = GetColor(0), arrowColor = GetColor(0), name = “RSI_LE”);
AddOrder(OrderType.SELL_TO_CLOSE, rsi crosses below overBought, tickColor = GetColor(1), arrowColor = GetColor(1), name = “RSI_LX”);
AddOrder(OrderType.SELL_TO_CLOSE, trend == -1, tickColor = GetColor(2), arrowColor = GetColor(2), name = “TrendLX”);

Marked as spam
Posted by (Questions: 4, Answers: 3)
Asked on December 22, 2018 6:53 am
342 views
0
Private answer

I think this should work. Haven’t tested it.

input price = close; input length = 14; input overBought = 70; input overSold = 50; input percentageReversal = 20.0; input averageType = AverageType.WILDERS;
def rsi = reference RSI(price = price, length = length, averageType = averageType); def trend = reference ZigZagTrendPercent(price = price, “reversal amount” = percentageReversal);
plot data = if rsi crosses above overSold and trend == 1 then 1 else if rsi crosses below overBought or trend == -1 then 0 else 9;

Keep in mind the value of 1 or 0 will only appear for bars in which the buy or sell conditions are true. Otherwise I have the value set to 9 for no signal.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on December 22, 2018 10:47 am