/ES Futures Trading Strategy on ThinkorSwim

Wave Trend Oscillator Upper Signals

Code:
#WT_LB Short Name TV
declare upper;
input Channel_Length = 10; #10
input Average_Length = 21; #10
input over_bought_1 = 60;
input over_bought_2 = 53;
input over_sold_1 = -60;
input over_sold_2 = -53;
input show_bubbles = yes;
input show_sec_bbls = no;
input show_alerts = yes;
def ap = hlc3;
def esa = ExpAverage(ap, Channel_Length);
def d = ExpAverage(AbsValue(ap - esa), Channel_Length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, Average_Length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 4);

def signal1 = wt1 crosses above wt2 and wt1 < over_sold_2;

def signal2 = wt1 crosses below wt2 and wt1 > over_bought_2;


# Plot Signals
plot bullish = signal1;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish.SetDefaultColor(Color.CYAN);
bullish.SetLineWeight(5);

plot bearish = signal2;
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish.SetDefaultColor(Color.MAGENTA);
bearish.SetLineWeight(5);
 

New Indicator: Buy the Dip

Check out our Buy the Dip indicator and see how it can help you find profitable swing trading ideas. Scanner, watchlist columns, and add-ons are included.

Download the indicator

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Here's a little something that some of you might find handy if you have multiple monitors. It's a 6 panel flexible grid with /NQ & QQQ, /ES &SPY and /RTY & IWM to include the RSILE_FE study modified by @skynetgen. At a glance, it helps to see if one market is moving where the other is not , so you can jump to the moving market. NOTE: the charts are set to the 1 minute timeframe.

(You might need to actually 'copy' the "Learning Center" URL below (to paste into TOS) because clicking on it from your browser only takes you to the learning center webpage.)
https://tos.mx/CcJ6RCz
Cannot figure out how to get copy the Link it keeps taking me to the learning center?
 
@blakecmathis i am new to trading options. With indicators from your strategy, i paper traded SPX options for 2 days in a row and up 35%. Thanks a lot for sharing this strategy. I use the link (https://tos.mx/4gmXmj2) you shared earlier. just curious, do i always get the latest and greatest (new enhancements, etc) by using that link? please suggest.
 
I just got off the phone with TD Ameritrade. Some are having issues accessing the links. I lost access a couple of days ago. They did an update then. They are doing a patch tomorrow night to fix it. The links should be working fine again after that.

The error routes all links to https://tos.mx/center/howToTos
 
Cannot figure out how to get copy the Link it keeps taking me to the learning center?

Just right button click on the link in your browser and select "copy link location" (Firefox). Then use that link in TOS to Open Shared Item.
 
Edit: Nevermind. I fixed it with the help of a @tomsk post for SuperTrend ATR CCI Trend here. https://usethinkscript.com/threads/supertrend-cci-atr-trend-for-thinkorswim.1090/#post-9561

I tried my hand at editing (merging) a couple of scripts b/c I was impressed by what I saw on a @blakecmathis 2000t chart awhile back...where the CCI_ATR_COMBO switched from placing colored dots on the candle, but actually painted the candles instead. I used SLIM_RIBBON for the "plot Colorbars" code, but for some reason, all of my candles end up yellow. @Anyone have an idea what I've done wrong? I guess I could have just asked @blakecmathis for the code, but I like to tinker with code (at least editing/modifying others' code) and hoped to achieve this by myself.

Thanks!

Code:
def c = close;
def h = high;
def l = low;
def pricedata = hl2;

#SUPERTREND
input ST_Atr_Mult = 1.0;
input ST_Length = 4;
input ST_AvgType = AverageType.HULL;

def ATR = MovingAverage(ST_AvgType, TrueRange(high, close, low), ST_Length);
def UP = HL2 + (ST_Atr_Mult* ATR);
def DN = HL2 + (-ST_Atr_Mult * ATR);
def ST = if close < ST[1] then UP else DN;

def SuperTrend = ST;


#CCI_ATR
input lengthCCI = 50;
input lengthATR = 21;
input AtrFactor = 1.0;

def ATRcci = Average(TrueRange(h, c, l), lengthATR) * AtrFactor;
def price = c + l + h;
def linDev = LinDev(price, lengthCCI);
def CCI = if linDev == 0
          then 0
          else (price - Average(price, lengthCCI)) / linDev / 0.015;

def MT1 = if CCI > 0
          then Max(MT1[1], pricedata - ATRcci)
          else Min(MT1[1], pricedata + ATRcci);
def CCI_ATR_TREND = MT1;

plot ST_ATR_COMBO = if C> ST and C>CCI_ATR_TREND then min(CCI_ATR_TREND, ST) else if c< ST and c<CCI_ATR_TREND then max(CCI_ATR_TREND, ST) else CCI_ATR_TREND;

ST_ATR_COMBO.AssignValueColor(if c < MT1 and c <ST then color.magenta else if C > MT1 and c >ST then color.CYAN else color.white);
ST_ATR_COMBO.setPaintingStrategy(paintingStrategy.LINE_VS_POINTS);


## new code to paint then candles the same color as the ST_ATR_COMBO

plot Colorbars = if C> ST and C>CCI_ATR_TREND then min(CCI_ATR_TREND, ST) else if c< ST and c<CCI_ATR_TREND then max(CCI_ATR_TREND, ST) else CCI_ATR_TREND;

Colorbars.AssignValueColor(if c < MT1 and c <ST then color.magenta else if C > MT1 and c >ST then color.CYAN else color.yellow);

colorbars.hide();

Colorbars.definecolor("Buy_Signal_Bars", color.CYAN);

Colorbars.definecolor("Sell_Signal_Bars", color.MAGENTA);

Colorbars.definecolor("Neutral", color.yellow);



AssignPriceColor(if Colorbars ==1 then colorbars.color("buy_signal_bars") else if colorbars ==2 then colorbars.color("Sell_Signal_bars") else  colorbars.color("neutral"));

#end
 
Last edited:
Edit: Nevermind. I fixed it with the help of a @tomsk post for SuperTrend ATR CCI Trend here. https://usethinkscript.com/threads/supertrend-cci-atr-trend-for-thinkorswim.1090/#post-9561

Here is the resulting code:
Code:
# SUPERTREND BY MOBIUS AND CCI ATR TREND COMBINED INTO ONE CHART INDICATOR, BOTH IN AGREEMENT IS A VERY POWERFUL SIGNAL IF TRENDING. VERY GOOD AT CATCHING REVERSALS. WORKS WELL ON 1 AND 5 MIN CHARTS. PLOT IS THE COMBINATION LOWEST FOR UPTREND AND HIGHEST OF THE DOWNTREND. DOTS COLORED IF BOTH IN AGREEMENT OR GREY IF NOT -  08/10/19 DTEK

# Code added at the bottom by @RickKennedy to add a new plot to paint the candles the same color as the ATR_CCI_COMBO plot    12/28/19


def c = close;
def h = high;
def l = low;
def pricedata = hl2;

#SUPERTREND
input ST_Atr_Mult = 1.0;
input ST_Length = 4;
input ST_AvgType = AverageType.HULL;

def ATR = MovingAverage(ST_AvgType, TrueRange(high, close, low), ST_Length);
def UP = HL2 + (ST_Atr_Mult* ATR);
def DN = HL2 + (-ST_Atr_Mult * ATR);
def ST = if close < ST[1] then UP else DN;

def SuperTrend = ST;


#CCI_ATR
input lengthCCI = 50;
input lengthATR = 21;
input AtrFactor = 1.0;

def ATRcci = Average(TrueRange(h, c, l), lengthATR) * AtrFactor;
def price = c + l + h;
def linDev = LinDev(price, lengthCCI);
def CCI = if linDev == 0
          then 0
          else (price - Average(price, lengthCCI)) / linDev / 0.015;

def MT1 = if CCI > 0
          then Max(MT1[1], pricedata - ATRcci)
          else Min(MT1[1], pricedata + ATRcci);
def CCI_ATR_TREND = MT1;

plot ST_ATR_COMBO = if C> ST and C>CCI_ATR_TREND then min(CCI_ATR_TREND, ST) else if c< ST and c<CCI_ATR_TREND then max(CCI_ATR_TREND, ST) else CCI_ATR_TREND;

ST_ATR_COMBO.AssignValueColor(if c < MT1 and c <ST then color.magenta else if C > MT1 and c >ST then color.CYAN else color.white);
ST_ATR_COMBO.setPaintingStrategy(paintingStrategy.LINE_VS_POINTS);


# New code:  Candle Colors

AssignPriceColor(if c < MT1 and c <ST then color.magenta else if C > MT1 and c >ST then color.CYAN else color.white);
#end
 
@RickKennedy Start over.
Do you need a plot of colorbars?
Did you define the values for "Buy_Signal_bars" etc.

Do not complicate it. Just think what conditions will paint bars cyan or magenta and then yellow becomes previous conditions not met.

hahaha you cheated. Glad you got it. I was a bit late.
 
Thanks @horserider for jumping in though. Yeah, that first set of code from SLIM RIBBON was so much more complicated than the simple 1 line of code from the SUPERTREND ATR CCI. :)
 
@tomsk Thanks for pointing that out. I thought the same as well. Just finished watching one of TheoTrade videos on it. And he said the same. @horserider I would consider looking at the indicator again. What you just said is the opposite of how the FE works.

@BenTen .... Thanks so much for mentioning the TheoTrade video on this subject!! 52 minutes (well actually about 45 min before the sales pitch) of detailed, intensive explanation of the RSI-LE/Fractal Energy portion of this strategy system. For anyone here who wants a deeper understanding of this (to include setting up TOS scans and using it for options trading [which i don't do]), I highly recommend this video. I knew that a low FE meant exhaustion of a move, but I was always a bit unclear about what a high FE might mean. It's all explained, with examples. And, a great nugget I pulled was the value of using the RSI portion of the indicator. Mostly in the charts that have been posted here, the RSI plot is turned off (I think). Now I see it as imperative....another point of confirmation.

Anyone want to check it out, I'm posting the link here.

 

Ben's Swing Trading Strategy + Indicator

I wouldn't call this a course. My goal is zero fluff. I will jump right into my current watchlist, tell you the ThinkorSwim indicator that I'm using, and past trade setups to help you understand my swing trading strategy.

I'm Interested

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
460 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top