fbpx

Become a Successful Trader

April 12, 2011

NYSE Tick & Breadth: Thinkorswim Chart Setup

Trading with market internals such as the NYSE tick and market breadth can lead to increased efficiency in your entry’s and exits. While they are most commonly used for intraday trading, it is possible to trade larger timeframes.

The NYSE tick is only available during regular trading hours of 9:30 AM EST – 4:00 PM EST as the data is derived from the New York Stock Exchange.

The charts code below is for thinkorswim.

Here I have optimized my NYSE tick chart setup for day trading the E-mini S&P Futures.

 

Instructions for Installing the Code:

To setup your chart per the video above, click on

Studies > Edit Studies > New Study (bottom left)

Delete ‘plot Data = Close;’ and paste the following code below.

Note: You can modify the parameters in the properties box

NYSE Tick Range Code

(Original code courtesy of thinkscripter, but it has since been modified)

Copy this tick range code into the new study box in thinkorswim®.

NYSE Tick, Breadth, & AD Line

Breadth Box Code

Same as above, copy this code into a new study, save and activate.
def A = close(“$UVOL”);
def D = close (“$DVOL”);
def ADL = Round(A / D, 1);
def ADR = if A > D then Round(A / D, 1) else Round(-D / A, 1);
input mode = {default Ratio};
def modeSwitch = if mode == mode.Ratio then 1 else 0;
AddLabel(yes, Concat(
if modeSwitch then ADR else ADL, Concat(” “,
if modeSwitch then “:1” else ” “)),
if modeSwitch then if ADR > ADR[1] then Color.GREEN else Color.RED else if ADL > ADL[1] then Color.GREEN else Color.RED);
plot null = Double.NaN;

Advance/Decline Box Code

def A = close(“$ADVN”);
def D = close (“$DECN”);
def ADL = Round(A / D);
def ADR = if A > D then Round(A – D) else Round (-D + A);
input mode = {default Ratio};
def modeSwitch = if mode == mode.Ratio then 1 else 0;
AddLabel(yes, Concat(
if modeSwitch then ADR else ADL, Concat(” “,
if modeSwitch then ” ” else ” “)),
if modeSwitch then if ADR > ADR[1] then Color.GREEN else Color.RED else if ADL > ADL[1] then Color.GREEN else Color.RED);
plot null = Double.NaN;
Get My Top 5 Trading Tools

Join over 10.000 visitors who are receiving a short weekly trading newsletter and learn how to trade for a living. Plus get my top 5 trading tools and 3 free chapters of my Trading Rules eBook.
We hate spam. Your email address will not be sold or shared with anyone.
Methodology , ,
About Tim Racette
Tim Racette is a day trader of 15+ years in the E-mini futures and swing trader of stocks. Mountain biker, lover of the outdoors, and explorer. Tim is an ASU Sun Devil and a Chicagoland Native now living in sunny Scottsdale, AZ.
62 Comments
  1. Tim this is brilliant! Thanks very much, specially for the Breadth Box Code. I’ve seen it on your setup before, it’s great that you shared it 🙂

  2. just came across your site. thanks. it’s great

  3. Free advice that really works is rare. Thank-you for this insight. You clearly have some great ideas for making day trading a bit easier.

  4. I’m really enjoying all the free info on your site, much appreciated.

    I’m a struggling ES trader looking to get better. I’m using ToS and have implemented your tools on this page.

    Thanks!

  5. I have seen your webinar with IF this week, and I’m really amazed of your E-mini S%P trading system, its simplicity is a great catch; now I see your site and I’m astonished for all the free info you share,
    Thanks!

  6. Hi Tim, is ToS Think or Swim a charting software service run by Ameritrade simular to Esignal Supercharts etc.?Ill get to your web site asap. Take care, eat well, sleep well, live well, and of course…..trade well.

    • Yes it is John. TDAmeritrade acquired Thinkorswim in June of 2011. Esignal and Tradestation offer very comparable platforms, I’ve just been with TOS for the past 6 years and thus built some platform loyalty.

  7. Hello, I having trouble copying the code. The next message appear:

    Invalid statement: AddChartLabel at 7:1

  8. Yeah I am getting the same error, Nato did you get it figured out?

  9. I think AddChartLabel has been replaced by addlabel, so the code should be:

    def A = close(“$UVOL”);
    def D = close (“$DVOL”);
    def ADL = Round(A / D, 1);
    def ADR = if A > D then Round(A / D, 1) else Round(-D / A, 1);
    input mode = {default Ratio};
    def modeSwitch = if mode == mode.Ratio then 1 else 0;
    addlabel(yes, concat(
    if modeSwitch then ADR else ADL, concat(” “,
    if modeSwitch then “:1″ else ” “)),
    if modeSwitch then if ADR > ADR[1] then color.green else color.red else if ADL > ADL[1] then color.green else color.red);
    plot null = Double.NaN;

    I am NOT positive this is doing the same thing as the original code, so use at your own risk, but as of 11/18/2012 this removes the error on the TOS platform.

  10. I cannot get the Breadth Box code to work correctly in TOS. I am getting an error when I try to create the study.

  11. I tried the modified code in Prescott’s post and still get an error from line 7 “addlabel” down through the end of the code.

  12. The script work. But they doesn’t refresh data. Any help please!

  13. Nick over at thinkorswim informed me that the last update caused an issue with the ‘AddLabel’ command. The latest update has since fixed the issue and the code above is working correctly on my system. You should be good to go!

  14. Tim, I use Infinity as the broker and Sierra Charts for charting. I have looked for something like this on their system with no luck, any ideas about how to build the above in Sierra?

    • That I don’t Robert. Have you asked Jim or your individual broker at Infinity? I just Googled “Market Internals for Sierra Charts” and there were a couple of forum posts that might be helpful.

  15. I was having the same problem with the “breath box” not working in TOS, but I got it to work. Here is the script again. Thanks so much for this Tim.

    def A = close(“$UVOL”);
    def D = close (“$DVOL”);
    def ADL = Round(A / D, 1);
    def ADR = if A > D then Round(A / D, 1) else Round(-D / A, 1);
    input mode = {default Ratio};
    def modeSwitch = if mode == mode.Ratio then 1 else 0;
    AddLabel(yes, Concat(
    if modeSwitch then ADR else ADL, Concat(” “,
    if modeSwitch then ”:1 ” else ” “)),
    if modeSwitch then if ADR > ADR[1] then Color.GREEN else Color.RED else if ADL > ADL[1] then Color.GREEN else Color.RED);
    plot null = Double.NaN;

  16. Sorry I should clarify how I made the change. At line 7, I deleted all info. from that line down, and then copied and pasted the code from the “ADVN/DECN that Tim has above.
    Then all I added was :1
    For some reason, even tho’ the codes are exactly the same from line 7 onward…the breath box code does not seem to want to compute in TOS, but A/D will. So now it should work.

  17. I’m copying and pasting what Trader69 has above and its not working.

  18. Hi Maurice, this is copied directly from my TOS Studies Editor…

    def A = close(“$UVOL”);
    def D = close (“$DVOL”);
    def ADL = Round(A / D, 1);
    def ADR = if A > D then Round(A / D, 1) else Round(-D / A, 1);
    input mode = {default Ratio};
    def modeSwitch = if mode == mode.Ratio then 1 else 0;
    AddLabel(yes, Concat(
    if modeSwitch then ADR else ADL, Concat(” “,
    if modeSwitch then “:1″ else ” “)),
    if modeSwitch then if ADR > ADR[1] then Color.GREEN else Color.RED else if ADL > ADL[1] then Color.GREEN else Color.RED);
    plot null = Double.NaN;

  19. Awesome new share study in thinkorswim allows me to share the studies as links. Here are the Breadth and AD Line Studies:

    Breadth: http://tos.mx/s2f72s
    AD Line: http://tos.mx/n5rvRm

    TickRange: http://tos.mx/n5rvRm

  20. Tim, thanks for sharing. I am enjoying your site the education and knowledge sharing by you.

  21. Awesome site. Downloaded the breadth indicator. Quick question, how can i get the data box to show with the opening bredth so I can see where it is in relation to where it started…like you have on the market internals bredth page

    • Hi Matt, I think this code will work as it has in there NBO for NYSE breadth open and QBO for NASDAQ breadth open.

      def UV = close(“$UVOL”);
      def DV = close (“$DVOL”);
      def UVQ = close(“$UVOL/Q”);
      def DVQ = close (“$DVOL/Q”);
      def PosR = if UV > DV then round(UV / DV,1) else round(-DV / UV,1);
      def PosRQ = if UVQ > DVQ then round(UVQ / DVQ,1) else round(-DVQ / UVQ,1);

      def AV = close(“$ADVN”);
      def DC = close (“$DECN”);
      def Market_Open_Time = 0930;

      rec TheDaysOpen = if(secondsTillTime (931) == 0, PosR, TheDaysOpen[1]);
      rec TheDaysOpenQ = if(secondsTillTime (931) == 0, PosRQ, TheDaysOpenQ[1]);
      Def TimeCondition1= secondsFromTime(959) == 0;
      Def TimeCondition2= secondsFromTime(1059) == 0;
      Def TimeCondition3= secondsFromTime(1159) == 0;
      Def TimeCondition4= secondsFromTime(1259) == 0;
      Def TimeCondition5= secondsFromTime(1359) == 0;
      Def TimeCondition6= secondsFromTime(1029) == 0;
      Def TimeCondition7= secondsFromTime(1129) == 0;
      Def TimeCondition8= secondsFromTime(1459) == 0;
      Def TimeCondition9= secondsFromTime(1544) == 0;

      AddChartLabel(YES, concat(
      “NBO=” ,TheDaysOpen),
      if TheDaysOpen >=0 then color.green else color.red);

      AddChartLabel(YES, concat(
      if UV > DV then round(UV / DV, 1) else round(-DV / UV, 1), “:1 NBreath”),
      if PosR > TheDaysOpen then color.green else color.red);

      input timeFrame = {default DAY, “2 DAYS”, “3 DAYS”, “4 DAYS”, WEEK, MONTH, “OPT EXP”};

      AddChartLabel(YES, concat(
      “QBO=” ,TheDaysOpenQ),
      if TheDaysOpenQ >=0 then color.green else color.red);

      AddChartLabel(YES, concat(
      if UVQ > DVQ then round(UVQ / DVQ, 1) else round(-DVQ / UVQ, 1), “:1 QBreath”),
      if PosRQ > TheDaysOpenQ then color.green else color.red);

      AddChartLabel(YES, concat(
      if AV > DC then round(AV / DC, 1) else round(-DC / AV, 1), “:1 ADratio”),
      if AV > DC then color.green else color.red);

      AddChartLabel(YES,concat (
      AV – DC,”A/D”),
      if ((AV – DC)> 400 or (AV – DC)< -400) then color.wHITE else color.daRK_GRAY);

  22. WOW! Thanks A LOT!

  23. Tim, thanks again. Quick question. I copied it just as it is above. The first day it worked just as I expected. But that was the only day it has printed/registered a number in the NBO and QBO boxes…since then they just show zero. Any thoughts?

  24. Will to, thanks Tim!

  25. Hi Tim

    Does the breadth and ad box just turn black outside of rth? just checking i have it installed correctly

    Thanks

  26. for any one having problems getting code to work. I noticed that copy and paste left some strange characters, odd shape quotation marks and extra spaces that could contain strange ascii codes of unprintable characters. I did a little editing to fix this and it worked ok. This may be a problem with chrome ar maybe just my installation of chrome.

  27. I do not like to use charts that I do not understand so I spent some time looking at these scripts. They are generally pretty hacked up. I would be happy to fix them if you can tell me what you want. Here is an example of one that is “fixed,” except I don’t know what math you want or what display you want. this is an advance decline box that has a parameter that is configurable to let you choose between advance decline ratio or absolute advance decline.

    #define to variables to hold the data points
    def A = close(“$ADVN”);
    def D = close (“$DECN”);
    #define a variable for the ratio rounded to #two digits
    def ADR = Round(A / D,2);
    #define a variable for absolute breadth
    def ADAB = Round(AbsValue(A-D),2);
    #define an input mode to select which solution #is desired
    input mode = {default Ratio, Absolute};
    #now we check to see which property is #selected
    def modeSwitch = if mode == mode.Ratio then 1 else 0;
    #and add a label and content depending on #which choice is wanted
    AddLabel(yes, Concat(
    if modeSwitch then ADR else ADAB, Concat(” “,
    if modeSwitch then “ADR” else “ADAB”)),
    if modeSwitch then if ADR > ADR[1] then Color.GREEN else Color.RED else if ADAB > ADAB[1] then Color.GREEN else Color.RED);
    plot null = Double.NaN;

    this probable cannot be copied and pasted because the comment lines wrapped. I added some pound signs to try and fix it but don’t know.

    here is a mytrade link;

    http://tos.mx/7xBWsh

    Archie

  28. How do you use these 2 labels, what are the trigger signs for your study?

  29. Hi Tim, I copied and pasted the codes that you posted on Aug 22, 2014 in my ToS. On my minute chart, all breadth box indicators are updated real time, except that NBO and QBO keep showing zeroes. Any clue why it happens?

    • Good question Ed, I know with a few of the recent TOS updates some of the code has been adjusted. Your best bet is to shoot a note to support@thinkorswim.com and paste the code into the email and see if they can point out what needs to be adjusted. Not sure why it works in some platforms and not others.

    • Ed,

      I experience the same thing and with a little bit of experimenting I think I may have figured out how to make it work.

      Please see the changes below and let me know if it works for you.

      rec TheDaysOpen = If(SecondstillTime (0931) >= 60, PosR, TheDaysOpen[1]);
      rec TheDaysOpenQ = If(SecondstillTime (0931) >= 60, PosRQ, TheDaysOpenQ[1]);

      I’m still trying to figure out how to make it work on the day chart. SecondsTillTime always = 0 so the above statement will always default to PosR and PosRQ and never the TheDaysOpenx[1].

      Hope this helps.

      • I received a reply from ToS:

        “The issue you are running into is due to your use of the secondstilltime functions used for the “Threedaysopen” and ThreedaysopenQ” variables used in this code. The secondstilltime function requires that the aggregation period to able to plot at the designated time. For example, you have designated a time of 931 or one minute after the market open. In order for this to function properly, we would need to be using a chart that has a one minute aggregation period. If the aggregation period were set to a larger increment, it would cause problems in the code. If the time was changed to 930, the code would function on more aggregation periods, but in order to use the current code, the chart would need to be set to a one-minute aggregation period.”

  30. Hi Tim,

    Thanks for the great work. I was wondering if you still use the $tick. I couldn’t get the NYSE tick code range working. There are some yellow arrow on the chart, i don’t know why.

  31. Just a note to anyone who might be having trouble getting the scripts to work, I found that simply copy/pasting the code into a ToS study did not work because the quotation marks in the website text are different characters than typing a normal quote on the keyboard and ToS did not like them. Once I typed in the quotation marks by hand, it worked. Hopefully this helps someone.

  32. Tim,

    First of all, thank you for all this. I have a question about the tick range study. i assume the yellow arrows are just to show when a bar crosses the 1000 level.Is that correct? Also, when i entered the code into thinkscript, it looks like it added bollinger bands too. in your video, i didnt see any. can you explain a little more how you use the bollinger bands?

    • Hey Eric, that’s right the lighter colored line at the top and bottom just highlight the high tick for the day, they’re not really Bollinger bands, just a way to identify the highs and lows. You could get rid of them and just put a horizontal line at +/- 1000 if you want, that works too.

  33. Hello blogger, i must say you have hi quality content here.
    Your page should go viral. You need initial traffic boost only.

    How to get it? Search for: Mertiso’s tips go viral

  34. Hi Tim

    How can I put a button in the upper left of the $ TICK movement?

  35. Hi Tim,
    Here it is February of 2022 and your codes still work! That’s shocking, great job! The only obstacle that I ran into was learning how to customize the NYSE Tick Range graph so it would like your yours. To do this one has open the customization box for the the individual study by:

    1. Double clicking on one of the horizontal lines on the graph.

    2. Under the section labeled “Plots” one needs to go through all the tabs and play with them, until the appearance is to their liking.

    Good luck.

  36. Thanks Tim. It really helps to improve my trading. It is awesome!

Leave a Reply