• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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
        Patrick H.NinjaTrader Customer Service

        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.
                    Patrick H.NinjaTrader Customer Service

                    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.
                            Patrick H.NinjaTrader Customer Service

                            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 scfnkysx, Today, 12:30 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post scfnkysx  
                              Started by jimloforkocv, Today, 12:16 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post jimloforkocv  
                              Started by claxxical, Yesterday, 10:00 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post claxxical  
                              Started by ct, Yesterday, 08:13 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post ct
                              by ct
                               
                              Started by Lumbeezl, Yesterday, 05:17 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post Lumbeezl  
                              Working...
                              X