Thinkorswim MTF MACD Scan 20


Create a Scan Based on Multiple Time Frame MACD

Thinkorswim MTF MACD Indicator

Thinkorswim MTF MACD Indicator

This is just a quick article (no video). I received several requests from viewers to demonstrate how to create a custom scan based on the Multi Time-Frame MACD indicator. This MTF MACD indicator is available free via the link embedded in the video located HERE, in a post called Thinkorswim MTF MACD Indicator. You will not need the indicator to build this scan, but be sure to go get it so you can plot it on your charts.

One more thing before we jump right in. If you are not familiar with building custom scans in the Thinkorswim platform, be sure to check out these posts to get up to speed: Thinkorswim Custom Scan Stochastic MACDThinkorswim Scan TTM Squeeze HistogramThinkorswim Scan MACD RSI Part Two. Everything presented here assumes you’ve already viewed at least one of these videos. So if you feel lost… take the few minutes to watch them and get up to speed.

Ok, here it is. As long as you’ve seen the previous videos, I can show you how to build this scan in two screen shots.

This first screen shot is the Scan tab on the Thinkorswim platform. It shows I’ve added three custom study filters. These are added by pressing the button titled “Add Study Filter”. Make sure you set each of the three to your desired time frame. In this case I’ve got mine set to Monthly, Weekly, and Daily. In the next step, you need to click the pencil icon for each of the three studies. The pencil icon opens up the code editing dialog box. I will provide the code here in this post. Scroll down to the next screen shot.

Setting up the MTF Scan

Setting up the MTF Scan

Ok, here is the code dialog box. I’ve clicked to select the tab titled “thinkscript Editor”. Just copy the code from this post into this screen on your platform. Notice the annotations in this screenshot indicate you can flip this from long to short by moving the “#’ symbol. Scroll down for the code to copy into your platform.

The Code Box

The Code Box

There are two DIFFERENT blocks of code here. This first one is to be placed into the two higher time frames. So for this example, I would have this first code block pasted into my Monthly and Weekly time frames.

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
def Diff = MACD(fastLength, slowLength, MACDLength, averageType).Diff;
plot scan = Diff[1] > Diff[2];
# OR
#plot scan = Diff[1] < Diff[2];

This second code block is to be pasted into the lowest time frame. In this example, I have this code pasted into my Daily time frame.

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
def Diff = MACD(fastLength, slowLength, MACDLength, averageType).Diff;
plot scan = Diff[1] >= Diff[2];
# OR
#plot scan = Diff[1] <= Diff[2]; 

 

Don’t go anywhere yet. Here are some important tips:

Ok, that’s it. You’re done. Be sure to save the scan before you close the platform or it will be lost and you’ll have to rebuild it. Please note the code for this scan will ensure your higher time frames have at least one candle closed in the desired direction. This is important as it will remove any false signals (as are present in the current version of the MTF MACD Indicator). An updated indicator will be published in the near future. The other thing to note is the code for the lowest time frame is designed to pick only the very first signal in a series. So this scan is not going to pick up signals from 2-3 or more days ago. It’s going to pick up current signals only. So be sure to run it every day (if you are using the time frames displayed here).

Lean More:

Would you like to learn how to master the custom scan tools on Thinkorswim?

Click here: Thinkorswim Scans Beginner to Advanced

Learn how to build custom scans without writing any code: Thinkorswim Condition Wizard


About Pete Hahn

For those trying to contact me about our professional services you will find all those details here: https://www.hahn-tech.com/about/ Any questions not related to our professional services or premium indicators should be directed to the comment section of the applicable video or you may post a question in our Q&A Forum: https://www.hahn-tech.com/thinkorswim-forum-topics/

Questions? Comments? Post a review?

20 thoughts on “Thinkorswim MTF MACD Scan

    • Pete Hahn Post author

      Yes, just change the time frames on the various study filters. Add and remove study filters as needed. Did you read the article prior to posting this question? The reason I ask is that after watching this video your question should have already been answered.

    • Pete Hahn Post author

      The columns displayed in the results section of a scan can be modified just the same as any watchlist. However this video did not included any code for custom watchlist columns.

      • Dan D

        great study! works perfect on the chart. how can this be turned into a scanner as well so we can scan to see which stocks have all 3 times frames the same (when all 3 are green or all 3 are red)?

  • Sudipta Sadhukhan

    Hi Pete,
    A small question I want to know how to use this scan to get stock where in weekly or daily chart it will be just 1-2 bars before the MACD crossover. Now this scan is showing the stock after the MACD crossover I want stock scan just before the crossover.

  • TK

    Pete, can you show me how to create a display that extracted scan data to show number of stocks in percentage above 50EMA, 100EMA, 200EMA? So can help to tell how strong or weak is the market. Thanks

  • Troy L Baker

    I am playing with this and trying to create a scan on an hourly basis. I find it is an early indicator for options and buying stocks before it shows on the daily. I am wanting 13/30/200 hourly and then look for crosses above and below the 200. Any thoughts?

    • Pete Hahn Post author

      Nope, I actually have no clue what you are requesting here. The context here is the MTF MACD study. Your question seems to be related to a series of 3 moving averages. If that is the case then this is the wrong place to enter this request. Try our Q&A forum.

  • Rob Miller

    I am a bit confused on what the MTF scans for? Today’s scan(2-17-17) pulled up AAPL for the first one. It has neither a red or green dot. I set up my scan the exact way you have posted except for the MACD, I like 8,17,9. Other than that identical. Can you tell me what I did wrong? Is there a way to scan for red/green dots on the histogram? I also have the second version of the indicator as well, it seems the first version gives much faster signals.

    Also, The MACD stochastics scan, I’ve set it up like you did in the video and it works great. I tried reversing what I thought was needed to pull up the short trades but had no luck. Any tips on what I should switch to pull up the opposite for short trades? Thanks for your help.

    • Pete Hahn Post author

      I’ll be able to provide much more detailed response if you post your question in our Q&A forum. As for your question about getting the results of the MTF MACD scan to match the indicator, be sure you are comparing it to version two and not the original. Version two is located here: Thinkorswim Strategy Guide MTF

  • Hilario Dsouza

    Hi Pete,
    I like the Multiple time frame approach and I am seeing it is pretty accurate for stocks (I added a few more indicators). I am applying a similar strategy to Futures. So lets take for example /CL with 133 tick, 233 tick, 1 min and 2 min. So to make it simple, when the SMA Crosses over the EMA and there is a confluence over all 4 charts, how can I get a SINGLE ALERT. (I dont mind keeping all the charts open in detached windows). Currently I am able to get 4 alerts (one for each chart).

    Thanks and Happy Holidays
    Hil

      • Pete Hahn Post author

        We could definitely provide more assistance if this were posted to the Q&A forum. So it sounds like y0u would like a chart based study using 4 time frames that would give you audible and visual alerts while the chart is open. If that is the case, then the solution is a bit more complex than we could provide in the Q&A forum. You should consider submitting this as a custom thinnkscript project using the contact form at the bottom of the “About” page.