@GetRichOrDieTrying Remove the following from the code.
AddChartBubble(close crosses below ST, low[1], low[1], color.Dark_Gray);
AddChartBubble(close crosses above ST, high[1], high[1], color.Dark_Gray, no);
# The following code is for backtesting
def SuperTrendUP = if ST crosses below close then 1 else 0;
def SuperTrendDN = if ST crosses above close then 1 else 0;
# Bullish Orders
AddOrder(OrderType.BUY_TO_OPEN, condition = SuperTrendUp, price = close,100, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "BUY");
AddOrder(OrderType.SELL_TO_CLOSE, condition = SuperTrendDN, price = open,100, tickcolor = Color.RED, arrowcolor = Color.RED, name = "SELL");
# Bearish Orders
AddOrder(OrderType.SELL_TO_OPEN, condition = SuperTrendDN, price = open,100, tickcolor = Color.RED, arrowcolor = Color.RED, name = "SELL");
AddOrder(OrderType.BUY_TO_CLOSE, condition = SuperTrendUp, price = close,100, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "BUY");
This is what I have for a magic trend I use it on ES:@BenTen Are you able to backtest this strategy with ThinkorSwim? Would like to see how it would work with ES future for example over a certain time period.
Unsure of how to make a backtest of this strategy, so any help would be great.
Thanks in advance.
Ben I tried to add this to my study its not working:@corello Put this together when I was on the go. See if it works. Add it to the bottom of the indicator.
Code:def bullish = close crosses below ST; def bearish = close crosses above ST; # Alerts Alert(bullish, " ", Alert.Bar, Sound.Chimes); Alert(bearish, " ", Alert.Bar, Sound.Bell);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
Archived: TMO True Momentum Oscillator | Indicators | 346 | ||
Archived: RSI Divergence Indicator | Indicators | 131 | ||
Archived: Opening Range Breakout | Indicators | 340 | ||
S | Smart Supertrend For ThinkOrSwim | Indicators | 13 | |
M | SuperTrend Oscillator [LUX] For ThinkOrSwim | Indicators | 7 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.