Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Output on Price Chart

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

    Indicator Output on Price Chart

    Hello

    Is there a way to plot the (numerical) output of an indicator on the price chart? (Much like the DrawTextFixed command but for indicator output values).

    Thanks

    #2
    Hello laocoon,
    Thanks for your post.
    Unfortunately plots takes double as a value only.

    You can use the DrawText object to print the values of the indicator for each bar. For example
    DrawText("str" + CurrentBar, Close[0].ToString(),0,Low[0] - 2 * TickSize, Color.Blue);
    will print the closing price of the bar 2 (two) ticks below the low of the bar.


    You might also find the StringSeries class handy regarding this http://www.ninjatrader.com/support/h...ries_class.htm

    Please let me know if I can be of any further assistance.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Originally posted by laocoon View Post
      Hello

      Is there a way to plot the (numerical) output of an indicator on the price chart? (Much like the DrawTextFixed command but for indicator output values).

      Thanks
      Actually you answered your own question.

      Code:
      DrawTextFixed("Indicator Value", "Indicator Value " + Value[0].ToString("C"), TextPosition.BottomRight, Color.Black, new Font("Arial", 10), Color.Empty, Color.Empty, 0);
      Last edited by koganam; 01-18-2012, 12:49 PM.

      Comment


        #4
        Thanks for your replies Joydeep & Koganam.

        Koganam:
        Thanks for posting a code snippet. Could I ask you to show me how you would modify the snippet in order for it to draw the output of the MACD indicator (or any other one)? I'm not sure how to replace the "Indicator Value" part of the snippet with the output variable of the indicator.

        Thanks a lot.

        Comment


          #5
          Thanks koganam for your input.

          Laocoon,
          The MACD code snippet will be:
          Code:
          DrawTextFixed("Indicator Value", "Indicator Value " + MACD(Close, 12, 26, 9)[0].ToString("C"), TextPosition.BottomRight, Color.Black, new Font("Arial", 10), Color.Empty, Color.Empty, 0);
          Please do let me know if I can assist you any further.
          JoydeepNinjaTrader Customer Service

          Comment


            #6
            Thanks a lot for that Joydeep.

            Just a quick question: I copied the snippet you provided and it works great, but it plots the MACD Value preceded by the letters "Fr.". Any idea as to what this means?

            Thanks

            Comment


              #7
              Hello laocoon,
              Since the code has a “C” it prints your local currency, Fr in your case. So if you remove the “C” it wont append the Fr.

              DrawTextFixed("Indicator Value", "Indicator Value " + MACD(Close, 12, 26, 9)[0].ToString("C"), TextPosition.BottomRight, Color.Black, new Font("Arial", 10), Color.Empty, Color.Empty, 0);
              Change to
              Code:
              DrawTextFixed("Indicator Value", "Indicator Value " + MACD(Close, 12, 26, 9)[0].ToString(), TextPosition.BottomRight, Color.Black, new Font("Arial", 10), Color.Empty, Color.Empty, 0);
              Please let me know if I can assist you any further.
              JoydeepNinjaTrader Customer Service

              Comment


                #8
                Thanks for this Joydeep, got it. I removed the "C" and the text disappeared indeed.
                The thing is, the indicator output now has 10+ decimals, where it had only one before.

                Example:
                Before: 4.1
                After: 4.1748384959

                Is there something I can do to remove the decimals?

                Thanks

                Comment


                  #9
                  We're glad to hear that lacoon, can you try this please for the formatting style :

                  DrawTextFixed("Indicator Value", "Indicator Value " + MACD(Close, 12, 26, 9)[0].ToString("N1"), TextPosition.BottomRight, Color.Black, new Font("Arial", 10), Color.Empty, Color.Empty, 0);
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Perfect, works like a charm.
                    Thanks Bertrand!
                    Last edited by laocoon; 01-20-2012, 06:56 AM.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by alifarahani, Today, 09:40 AM
                    3 responses
                    15 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by RookieTrader, Today, 09:37 AM
                    4 responses
                    17 views
                    0 likes
                    Last Post RookieTrader  
                    Started by PaulMohn, Today, 12:36 PM
                    0 responses
                    3 views
                    0 likes
                    Last Post PaulMohn  
                    Started by love2code2trade, 04-17-2024, 01:45 PM
                    4 responses
                    38 views
                    0 likes
                    Last Post love2code2trade  
                    Started by junkone, Today, 11:37 AM
                    3 responses
                    22 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Working...
                    X