Posts Tagged ‘Thinkscript’

A Look At a Few Charts: Revisited

September 3, 2019

As a follow-up to the charts I posted before my annual August hiatus, here’s what happened for each of those names. The yellow line in each of these charts is July 17, when I posted the charts before.

SPY:

The broad market ended up having a big drop as August started, but mostly recovered since then. If you tried to trade breakouts you got chopped to pieces. If you tried to fade breakouts you had to take a lot of heat during the chop for not a lot of benefit. This chart is textbook for how I used to give away a lot of my gains for the year by forcing trades during this time. I’m happy I sat this out. Things seem bleak for the markets going forward with global slowdowns and recession indicators flashing. I’m leaning toward taking more defensive long term positions here.

AAPL:

Earnings were good, AAPL spiked and then sold off all the gains. Then it dropped, and shorts got burned in that chop. In the end, it’s at the same level today as it was when I posted the chart before. Nothing but pain in August.

ROKU:

ROKU was the exception to my August rules. After some contraction before earnings, it popped and didn’t look back. If I weren’t sidelined by rule, I would have gone long on the Swing VWAP breakout at about $135. I have liked ROKU all year and in this case, breaking my rule would have paid off. Missing things like this and accepting it are important to having the right trading mindset. There have been so many good setups in ROKU this year, and I’ve been able to catch a few of them. It’s ok if I don’t get every one. Greed is a killer, as is fear of missing out, and begrudging any moves you may have missed.

TSLA:

TSLA ended up being pretty volatile with the earnings report and different news stories during August. Any of my typical setups would have lit me on fire. Lots of chop, lots of heat whether you traded breakouts or faded them. The only edge was in knowing the news and earnings beforehand, which is basically impossible unless you are cheating with inside info. Another good chart to watch rather than trade.

Going into the fall, I’ll keep an eye on any setups that may occur. I’m biased toward the bearish side, but we’ll see how things pan out.

Multi-Divergence Scan for Think or Swim: MACD, RSI, CCI Divergence in Your Stock Scans

September 13, 2016

In my Multi-Divergence indicator, there is logic used that breaks the study filter when you try to use it in a scan. So I made a new indicator specifically for scanning by limiting it to only use MACD, RSI or CCI. Now it can be used in a watchlist scan, and it’s called “Pro_Divergence_Scan”. It is still a donor-only script, so use your blog donor info to access it in the Released Thinkscript Studies section of the Google site. If you’re not a donor, you can chip in by clicking the Donate button:

Instructions:  Import Pro_Divergence_Scan like any other study, then follow these directions to set up a scan with it.

Go to the scan tab in Think Desktop, and choose “Stock Hacker”.  Then you click “Add Study Filter” (First in screenshot below) then click the pencil to edit the default filter that is added (Second in screenshot):

screen-shot-2016-09-11-at-7-19-25-pm

Delete the default ADXCrossover() if there is one (Third in screenshot) and then click “Thinkscript Editor” (Fourth):

screen-shot-2016-09-11-at-7-19-47-pm

Choose your Aggregation period at the top (D for Daily in this example).  In the editor, type in “Pro_Divergence_Scan()” and then choose “Inspector” from the side panel.  You’ll see the Pro_Divergence_Scan study inputs and the four plots that you can scan for:

    1. BullDivs for Bullish Divergence on short timeframe
    2. BearDivs for Bearish Divergence on short timeframe
    3. BullDivl for Bullish Divergence on long timeframe
    4. BearDivl for Bearish Divergence on long timeframe

 

screen-shot-2016-09-11-at-7-25-30-pm

(As an aside, you can also type the name of any other study you have in your library at this thinkscript editor to get access to it for any filter.)

For the scan to trigger, you want to check for when your chosen plot value is equal to 1, because that’s what I coded the indicator to do.  To do this, add the string “==1” after the plot name, as shown here:

screen-shot-2016-09-11-at-7-25-54-pm

After this, click “Ok” and run your scan.  You may get a pop-up that warns that future changes to the study will not be reflected in this filter.  That just means that if you change the code in the Pro_Divergence_Scan, it won’t be reflected here.  The filter takes a snapshot of the code when you make the filter.  If you update the indicator, just delete the old filter and set it up again as above.

UPDATE: MACD Divergence Indicator for Think or Swim

December 10, 2014

This indicator has been updated!  See the new post here.

This has been a long time in coming.  My family life has been in upheaval for a couple years now.  I finally had a bit of time so I wanted to get this done.  Thanks for staying with me.

Many people have asked for a version of the MACD Divergence Indicator that can run in a scan.  The old one I had ran on recursive logic and so wasn’t supported in scans.  This new one uses a different philosophy that runs in real time.  Before I would use my Swing Points and check the value of the MACD against them.  Higher swing highs and lower corresponding values of MACD on those bars would signal a bearish divergence.  Now I am using Linear Regression slopes to compare divergences.  Here’s the theory of how it works:

A linear regression is a way to fit a straight line through some data such that you get the least amount of average distance from the line. If the slope of the linear regression is up, then values are generally trending upward over the set of data you put in. If the slope is negative, then the values trend downward.

So I take a linear regression of price, then get the slope of the LR, and I also take a linear regression of the standard MACD indicator and get that slope. When the price slope is positive and the MACD slope is negative, we have a bearish MACD divergence. If price slope is negative and MACD slope is positive, we have a bullish divergence. If price slope and MACD slope are the same, we have a trend continuation (up/up or down/down). This chart shows this theory in action:

howitworks

 

Here’s what my indicator actually looks like.  The small arrows are short term divergences, the larger arrows are the long term divergences.  The short and long timeframes are inputs, so you can set them at whatever you want.  This chart uses 20 and 50 as the inputs, but you can experiment with what works best for what you are trading:

whatitlookslikenew

As with all divergences, just because it is there doesn’t mean that the trend must reverse. Sometimes divergences can go on for a long time. This information is good to give you a sense that a trend might reverse, and you can plan your own entry and stop accordingly.

Now, to set set up a custom scan, you follow the instructions in these pictures:

scan1

scan2

Then when your scan runs, you will get flagged if the divergence you asked for is currently found.

This indicator is for blog donors only.  You can find it on my google site under Released Thinkscript Studies down in the Donors Only section.

Thinkscript Chat Room Comes to Think or Swim

January 17, 2012

Today I got word from Think or Swim of a new resource for Thinkscript users and developers. The ToS folks are listening to the requests of their customers for more Thinkscript support. Within the next two weeks, there will be a new chat room inside of the Think Desktop platform covering the topic of Thinkscript! The idea is to build a ToS sanctioned community where people can share ideas and scripts, or just ask for help. It will be moderated by ToS. They plan to have free chat times, and also have the occasional presenter talk about a certain topic of interest like they do in the other rooms in Think Desktop.

As you may know, I tried to put up a little discussion board, but there wasn’t enough interest. I know that there are sporadic groups of folks on the yahoo boards, or communities at sites like Thinkscripter’s. Hopefully having a centrally located area will gather more people together. I think it will also be a good place to make requests for new features in the Thinkscript language and report any bugs that we see.

I see any attention given to Thinkscript from inside ToS as a big positive, since the management types don’t necessarily see it as a big profit center. The more we as customers show up and support the work of the ToS dev team, the more firepower they have to get resources to bring us more capability.

So look for this in your Think Desktop platform soon!

Volatility-Based Trailing Stop Strategies for Think or Swim

November 15, 2010

Here is my Volatility-Based Trailing Stop indicator implemented as strategies. These are only exit strategies at the moment, so if you use long and short entry strategies of your choice, these will stop you out if the corresponding trailing stop is breached.

These files are free. Download “VolatilityTS_Strategies.zip” from “Released Thinkscript Strategies” on my Google site.