Thinkorswim Scan Ichimoku 67

Custom Scan Based on Ichimoku

Thinkorswim Scan Ichimoku

Thinkorswim Scan Ichimoku

Free custom code linked below. Based on the Ichimoku study, this code will let you scan for Cloud Breakouts as well as Trend Continuation signals. The signals are crafted to mirror the techniques taught by Hubert Senters (videos linked below). It will scan for longs or shorts. Each scan signal has two versions. One captures the raw signal and the second adds a filter using the Chikou (Lagging Line) to confirm the bullish or bearish direction. This provides a total of 8 different signals you can use for scans.

Here is a link to the custom code for running the scans in Thinkorswim:


Here is the link to video instruction by Hubert Senters:

Ichimoku Trading Strategies For Finding Better Trades by Hubert Senters


*Thinkorswim is a chart analysis platform offered by TD

TD Ameritrade provides financial services including the trading of Stocks, Futures, Options and Forex.

Please be sure to share this page with your friends and colleagues. Leaving comments below is the best way to help make the content of this site even better.

Watch the video, Thinkorswim Scan Ichimoku below:

Questions? Comments? Post a review?

67 thoughts on “Thinkorswim Scan Ichimoku

  • Jim

    First of all, this is awesome. May I ask, how do I set up the scan for the “lagging line” crossing below the cloud or above the cloud and nothing else? Thank you

  • Roses O

    Hello Pete, Thanks for all your work.
    Please, is it possible to use the scan as a watchlist quote item and have background color to indicate which stocks have the triggers? I tried it, it shows “1” when there is a trigger, which is great but a way to stand out may help especially looking through old watchlist. This will be similar to what you have for ADX scans. Any help will be greatly appreciate.

  • Michael l Camper

    I’m having trouble downloading the code and converting in cloudconvert. Any help would be much appreciated.

  • Spencer

    Is is possible to set up the scan so that it only returns stocks that have the requirement (e.g., BreakAboveCloud and BullishConfirmation) for a certain time period? The problem that I am running into is that on my daily chart, it returns stocks that have this bullish indicator that are from later in the previous trading day.

    • Pete Hahn Post author

      I’m not sure I understand the question or the issue you are describing. If the chart and the scan are setup with the same exact settings, the scan is only able to return stocks that meet the criteria on the most current (active) bar on the chart. If you set everything to the daily time frame, the scan is only able to produce a list of stocks in which the signal is present on today’s candle. If you are getting results that do not match that description then you need to double check all of your settings.

  • Jantsen Harrington

    I click on the link to install the scanner into my ToS but it sends me to download it via google drive then as a movie file. How do i fix that so I can upload it to my ToS scanner? I copy and pasted the link to the “Open shared item” on ToS and it says the link is broke.

  • Sprint

    I’m a huge fan of your work. Thanks for all you do. Question. For your Scan_IchimokuSTUDY.ts is there a way to modify the scan so the results show if the signal was true “within X bars”. Sorry for such a basic question but my scripting skills are very limited although I am slowly learning by going through your videos. Thank you in advance for your help.

      • Sprint

        Thank you Pete. If it is an easy modification and you can share that would be great. If you cannot for any reason I understand and I appreciate all you do. I’ve learned a lot from your videos.

      • Pete Hahn Post author

        Each scan signal requires the same modification. Taking the very first scan signal from the list. The modification looks like this: plot scan = signalBreakAboveCloud within 10 bars;

  • Pete Hahn Post author

    This video is specifically for the Ichimoku scan. Not the chart study. It is possible to plot any code created for a scan as a lower study. But if you are looking for an Ichimoku chart study then you should be looking in the “TOS Charting” category.

    • Pete Hahn Post author

      Please stop posting code in the comments section of the video. This is not the place where we can provide assistance of this complexity. That’s what the Q&A Forum is for. I just used the link in the description this video to download the code used to run the scan. The code for the scan contains 73 lines. I don’t have the foggiest idea where you are getting this code from but it is not coming from the file I provided with this video.

    • Pete Hahn Post author

      Sorry, sometimes the best response I can give is blunt and rather harsh. Trust me that is not an easy thing for me to do. But over the years I have become better at knowing when to “punch that button” and help our viewers to get themselves out of the weeds.

  • OpenView

    Hello Pete,

    Thank you for your great contribution to the community!

    I noticed that Ichimoku setup in ToS (Chikou span line) is offset by 1 bar (27 instead of 26) – even in the standard Indicator in ToS, compared to TradingView and TradeStation. Is that a problem? What do you think the reason is?


    • Pete Hahn Post author

      That is a very good observation and I took some time to examine this from various sources. is what I consider an authoritative source on chart indicators. The charts they display for Ichimoku match the way Thinkorswim computes it. TradingView indeed computes it differently as does TradStation. However TradeStation provides an additional user input named “CountCurrentBarInOffset”. Set that input to zero and it matches Thinkorswim. So it appears to be a matter of preference, with TradeStation providing the most flexibility to adjust it according to user preference. This would have made for a very excellent post in our Q&A Forum. Very few folks will see this question and solution here in the comments section of the video.

  • Greg B.

    Hi Pete, thank you for all that you do. Could use your help as I can’t get a simplified scan to work.
    I need a scan, no plot, that will search a watchlist for when the Chikou crosses the cloud in any timeframe with a variable lookback period. Price is not a concern. Just want the stock to show in the scan when the chikou crosses within a certain amount of bars.

    1 – Show up on scan when:
    – the chikou crosses up over Span A when green cloud, or Span B when red cloud on any timeframe
    – the chikou cross occurred within the last x bars (variable input)

    2 – opposite of 1 for when it crosses down under the cloud

    Tried to do this with Conditions tool but the scans just won’t produce results. Also tried modifying your scan above with no success.

    Thank you!

    • Pete Hahn Post author

      It is not possible to provide such complex solutions in the comments section of a video. Be sure to search our Q&A forum first, as there are many posts on the Ichimoku in our forum. If you don’t find a solution already posted there then submit a new question in the forum.

  • Neo

    Hi Peter, can you confirm when the code says Chikou > Span A, does this account for Span A being -52 periods for Chikou to cross or does it consider Span A at current period?

    • Pete Hahn Post author

      As I recall, the Chikou is the current bar’s close displaced 26 bars to the left. Not 52 as you have stated. So being that the last value of Chikou printed on the chart is actually the current bar’s close. This would mean the current bar’s close is greater than Span A.

    • Neo

      In the code, defined Kijun_period is 26 periods. But I couldn’t figure out if this will be Span A’s current value (which is at +26 periods in future) or value at Chikou (-52 periods from current Span A). Thanks again.
      Sorry for the bother, but I am still learning the coding and trading.

      • Neo

        I may be interpreting the Cloud breakout wrong. But it seems like Chikou is -26 (Keijun Period) cross (value of -52 periods of Span A or B).

        I can see that Chikou being current price offset in 26 periods. However, I am not clear if the Span A value is also shifted back to 2x keijun periods.

        Its highly likely that I am totally wrong. For that I apologize and sorry for the trouble.

      • Pete Hahn Post author

        Well it has been 5 years since I published this and I built everything based on the teachings of Huber Senters. So I defer to him for the full explaination. However if you like to tinker with stuff like this you just need to create a custom chart study to plot this on a lower subgraph:

        declare lower;
        input tenkan_period = 9;
        input kijun_period = 26;
        input lookBack = 5;
        input breakOutBars = 3;

        def Tenkan = (Highest(high, tenkan_period) + Lowest(low, tenkan_period)) / 2;
        def Kijun = (Highest(high, kijun_period) + Lowest(low, kijun_period)) / 2;
        def “Span A” = (Tenkan[kijun_period] + Kijun[kijun_period]) / 2;
        def “Span B” = (Highest(high[kijun_period], 2 * kijun_period) + Lowest(low[kijun_period], 2 * kijun_period)) / 2;
        def Chikou = close[-kijun_period];
        plot test = Chikou > “Span A”;

        I use this technique throughout my entire library of tutorial videos as well as the development work I do every day of the week.

    • Pete Hahn Post author

      It’s very difficult to explain this without a screenshot. So please refer to the video linked in the description of the video that shows how Hubert Senters created this setup. That will explain things much more clearly than I can.

    • Pete Hahn Post author

      You get to pick whatever time frame you want. If you view the instructions provided by Hubert Senters you will find he covers both day trading and swing trading with this indicator.

  • InvestingDoc

    Thanks for the great tutorial and code. I’ve been looking at the Ichimoku for a while and read several references including a very interesting paper validating one of the trade signals ( I hope you can help me better understand the code though in two spots.

    1) For laggingLineOverCloud (and undercloud) you compare the Chikou (which is a period in the past) to the Span A or Span B which I gather is today. Shouldn’t the Chikou be compared to Span A at the same time period in the past as the Chikou? Or am I misinterpreting the comparison being made?

    2) Why does CloseCloudDiff only use Span B in the calculation? As currently written, wouldn’t UnderCloud or OverCloud potentially produce a signal in the cloud? UnderCloud actually in the cloud in a Bearish Cloud and OverCloud in the cloud in a Bullish Cloud?

    Thanks for the clarification

    • Pete Hahn Post author

      Did you view the video I linked from Hubert Senters? Everything in this code was taken directly from his specifications and his method of teaching the Ichimoku. His video was linked in the description of my video. None of this came from my own ideas or concepts of how this should be traded.

      • InvestingDoc

        I did. My question is not about the trade but about the code you provided to replicate those signals. I do not think the code accurately reflects the signals that are mentioned. Around the 21 minute mark he talks about the bearish strategy of price crossing the cloud with the lagging line below the cloud. He also explains how you will some of the up and downside but this is part of the process. The lagging line location compared to the cloud is compared to the cloud at the location of the lagging line which is a time period behind today. This brings me back to my original questions. It appears to me that your code is not comparing the Chikou to the right time point on the Span. And I reask my questions.

        If the code is correct, I apologize but would appreciate an explanation of how the code replicates the signals. Happy to talk off line if you would like to email me.

      • Pete Hahn Post author

        I think you will have more success reading the code if you start from the bottom and read backward. For the bullish break out with confirmation you find there are two conditions. signalBreakAboveCloud and signalBullishConfirmation. When you follow the second one further back in the code you find it gets its value from this: laggingLineOverCloud[kijun_period]. So this is where the code is looking backward (26 bars) to see if the lagging line is above the cloud (26 bars back).

        To see this graphically, plot this scan as a lower study, turn off all the plots and change this line from a def to a plot:
        def laggingLineOverCloud = (Chikou > “Span A” and bullishCloud) or (Chikou > “Span B” and bearishCloud);

        You will find that it correctly tracks when the lagging line is above the cloud, 26 bars back from the current bar.

        This line of code is how we check the true/false condition of that variable, looking backward 26 bars:
        def signalBullishConfirmation = laggingLineOverCloud[kijun_period];

        In case you want to see that graphically, simply change that statement from a def to a plot. You will see it replicates laggingLineOverCloud exactly 26 bars to the right.

        If this still doesn’t clear things up then post this in the Q&A forum were we can cover things in more detail with screenshots to visualize everything. But to answer your question. Yes, the code is behaving exactly as Hubert Senters defined it.

  • Dave G

    Pete, just wanted to thank you for all your fantastic work and patience. What an amazing resource you’ve created. Learning from your TOS posts and also looking forward as you get into TS a bit more

    • Pete Hahn Post author

      That suggestion was only valid if using intraday time frames. Not Daily. If you are having issues you cannot resolve then post a request in our Q&A forum. Be sure to include a screenshot showing a scan result that is inaccurate.

  • David Labate

    I tried several times to install the cloud scanners with your instructions and videos and found that they just don’t work properly

    • Pete Hahn Post author

      Details? Are you using intraday time frames or daily? If intraday, did you go to your chart settings and turn off the setting “start aggregation at market open”? Would love to assist you but I need details.

  • Kevin J Fitzgerald

    I have the scan loaded and available on ToS but the Scan button stays inactive. Is there something I can do? Thank you.

  • Patrick

    hi pete, i am a big fan of the ichimoku cloud. i am very interested in using the scan but i am having trouble importing it into TOS. when i down loaded it, it did not have .ts on the end so i added it. when i hit import and go to down loads it does not pop up. can you please help me with this. thanks

  • Dave L

    Pete, tried it and followed instructions and watched videos and scan does not work for me.
    thanks anyway

  • Marcelo

    thanks a lot for the explanation, this is great. Would you add the code to plot where the close enter into the cloud?, Thanks in advance Marcelo

    • Pete Hahn Post author

      If you are requesting some modification to detect a different type of signal I encourage you to post a request in our Q&A forum. Be sure to provide a full chart screenshot showing the exact pattern you want the scan to detect.

  • David Labate

    The written instructions show the scan going in the study.
    Are there instructions importing it into the scanning field?

    • Pete Hahn Post author

      It’s all in the video. I just watched this one again to make sure. All you have to do is watch the video from start to finish and don’t skip over anything.

  • David Labate

    Pete thanks for all you do to help.
    I am having a problem loading the scan. When it loads I only get the blue indicator line on the lower section and no cloud.and when I go to change the setting get scan under plots nothing else.

    what am I doing wrong

    • Pete Hahn Post author

      This is not a chart study. This is a scan. You copy and paste the code from the indicator into a scan and use it to scan for signals. This was demonstrated in the video, yes?

  • Warren Black

    Pete, Thank you so much for this. Your tutorial was great and the code works awesome. Ichimoku is my favorite study and I always wished there was a way I could scan for stocks specifically by stocks that have the turning line crossing the standard line. Is there anyway I could use the code to scan for turning/standard crosses above the cloud? Again, thank you for everything.

      • Steve

        Hey Pete, I have watched the video twice and I could be wrong, but I think Warrens question is asking about the Turning crossing the Standard above the cloud. I believe this scan (trendContinuationLong) only covers if the Turning crosses the Standard and the Lagging is above the cloud. Therefore, there are occasions with this scan where the Turning crosses the Standard, but this cross may occur in or below the cloud.

        Your videos are amazing by the way.

      • Pete Hahn Post author

        I just checked the code and both are supported. There are two scan plots for trend continuation. One that is plain and one that requires confirmation:
        # use this scan plot to find bullish trend continuation signals without confirmation
        #plot scan = trendContinuationLong;

        # use this scan plot to find bullish trend continuation signals with confirmation
        #plot scan = trendContinuationLong and signalBullishConfirmation;