Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Sentiment As an Indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sentiment As an Indicator

    Is there a way to express the market sentiments ^ADV, ^DECL, as "Breadth" in an lower-indicator window of a market chart? The equation would be:
    Breadth = ^ADV - ^DECL

    Thank You.

    #2
    Originally posted by randl View Post
    Is there a way to express the market sentiments ^ADV, ^DECL, as "Breadth" in an lower-indicator window of a market chart? The equation would be:
    Breadth = ^ADV - ^DECL

    Thank You.
    Add bar series for the 2 instruments to the indicator, which makes it a multiseries script. Do the calculations using the documented methods, and assign the result to the Plot().

    Assuming that the instruments are added in the order requested, ^ADV will be indexed as 1 and ^DECL will be indexed as 2, so
    Code:
    double Breadth = Closes[1][0] - Closes[2][0];
    Plot0.Set(Breadth);
    Of course you can do it in one line if your prefer.
    Code:
    Plot0.Set(Closes[1][0] - Closes[2][0]);

    Comment


      #3
      Thanks a Bunch Koganam!! That compiled, I will find out how well it works tomorrow I guess.

      One other question: if I have this statement in my code:

      Add(new Line(Color.Yellow, 0, "Lower"));

      Do I also have to have a Plot something statement? Because, the indicator showed up but I do not see the yellow line plotted across the zero mark.
      Last edited by randl; 11-03-2013, 03:46 PM.

      Comment


        #4
        Hello randl,

        Thank you for your post.

        Thank you to koganam for providing that information. You can also find an example of two instruments plotted together in a candlestick plot at the following link: http://www.ninjatrader.com/support/f...d=4&linkid=512

        Comment


          #5
          Originally posted by randl View Post
          Thanks a Bunch Koganam!! That compiled, I will find out how well it works tomorrow I guess.

          One other question: if I have this statement in my code:

          Add(new Line(Color.Yellow, 0, "Lower"));

          Do I also have to have a Plot something statement? Because, the indicator showed up but I do not see the yellow line plotted across the zero mark.
          That should draw the line. Try unloading and reloading the indicator on the chart.

          Also, are there any errors recorded in your log?

          Comment


            #6
            Sentiment as an Indicator

            YES, I have tons of "Invalid Instrument" Error messages (see the attached snag). It is not recognizing the way I did it:

            Add("ADV 12-13", PeriodType.Minute, 1);
            Add("DECL 12-13", PeriodType.Minute, 1);
            Add("UVOL 12-13", PeriodType.Minute, 1);
            Add("DVOL 12-13", PeriodType.Minute, 1);

            Is there another way to do this? The are in my default instrument list a ^ADV, ^ DECL, etc.
            Thanks
            Attached Files

            Comment


              #7
              Originally posted by randl View Post
              YES, I have tons of "Invalid Instrument" Error messages (see the attached snag). It is not recognizing the way I did it:

              Add("ADV 12-13", PeriodType.Minute, 1);
              Add("DECL 12-13", PeriodType.Minute, 1);
              Add("UVOL 12-13", PeriodType.Minute, 1);
              Add("DVOL 12-13", PeriodType.Minute, 1);

              Is there another way to do this? The are in my default instrument list a ^ADV, ^ DECL, etc.
              Thanks
              The error tells the story. Use the correct strings, as listed in the instrument manager.

              Comment


                #8
                Thanks I will do that.

                Comment


                  #9
                  Koganam, This indicator is not painting. It gives this error message (apparently I am missing some definition for bars):

                  11/4/2013 3:01 PM Default Error on calling 'OnBarUpdate' method for indicator 'MarketThrust' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.

                  Comment


                    #10
                    Hello randl,

                    Thank you for your update.

                    This is seen when accessing data that is not currently available on the chart. For information on resolving this matter please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=3170

                    Please let me know if you have any questions.
                    Last edited by NinjaTrader_PatrickH; 11-05-2013, 09:11 AM.

                    Comment


                      #11
                      Sentiment as an Indicator

                      Thanks Patrick that Got it!!! It plots now. One mystery remains, the EMA (as you see in the attached snag), does not plot. Do I need to put a plot statement for it in the code as well?
                      Attached Files

                      Comment


                        #12
                        randl, we're glad to hear that. Looks like the EMA plot is there, but set to transparent colors?
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          Sentiment as an Indicator

                          I don't think so. I changed the color to Yellow and the attached is the result.
                          Attached Files

                          Comment


                            #14
                            Hello randl,

                            Thank you for your response.

                            After changing to Yellow and then left clicking OK in the Indicators menu does the EMA plot? If not, do you see an error listed in the Log tab of the Control Center? In addition, if you open up the Indicators menu again is the color still set to Yellow or did it revert to another color?

                            Would it also be possible to review the code on our end? If so, please attach the indicator to your response. You will find the indicator in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Indicator

                            I look forward to your response.

                            Comment


                              #15
                              Sentiment as an Indicator

                              I sent you the attachment to show you: 1. what I did; 2. what the result was (no EMA plotted).
                              Attached please find what you asked for.
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by DJ888, 04-16-2024, 06:09 PM
                              4 responses
                              12 views
                              0 likes
                              Last Post DJ888
                              by DJ888
                               
                              Started by terofs, Today, 04:18 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post terofs
                              by terofs
                               
                              Started by nandhumca, Today, 03:41 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post nandhumca  
                              Started by The_Sec, Today, 03:37 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post The_Sec
                              by The_Sec
                               
                              Started by GwFutures1988, Today, 02:48 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Working...
                              X