• 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

Defining Plot Variable for Histogram

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

    Defining Plot Variable for Histogram

    I am trying to make a simple histogram of the difference between DmPlus and DmMinus from the DM indicator included with ninja trader.

    I saved the ninjatrader DM indicator as DmHistogram.

    In the NT indicator there is a line of code... double sum = DiPlus + DiMinus
    This would be the value of the histogram.
    Below this in the code the current plots are defined.

    Following this logic it tried to create/set a plot variable "HistPlot" = sum;
    attached screenshot

    I get an error 'HistPlot' does not exist n current context - error code CS0103

    I tried defining "HistPlot" -
    under Public class.. private series<double> HistPlot;
    under State.DataLoaded… HistPlot =new series<double>(this);
    Neither of these worked


    Any help on creating the histogram would be appreciated.
    Attached Files

    #2
    Hello sdauteuil,

    Is a public Series<double> HistPlot being defined?

    Can you show the Properties to show this Series<double> was defined?

    (See the MACD indicator on line 107 for an example)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      That is not being defined under the properties.

      Would I create the same code like line 141-146 for HistPlot? see attached

      Would I make a values[3] since there is already values 0,1 and 2. I am not sure exactly how the values relate to the plot.

      Attached Files

      Comment


        #4
        Hello sdauteuil,

        If a variable is not declared it cannot be used.

        Declare this public series if you want to use this variable.

        To return a 4th plot added with AddPlot():

        [Browsable(false)]
        [XmlIgnore()]
        public Series<double> MySeriesName
        { get { return Values[3]; } }
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you I was able to define the variable.

          I am now getting an error with the addplot code.

          I attached a screenshot and the code. I put /// in front of the line I was getting an error on so it would compile.
          Attached Files

          Comment


            #6
            Hello sdauteuil,

            PlotStyle.bar has bar lowercase. This needs to be uppercase. PlotStyle.Bar.
            https://ninjatrader.com/support/help...t8/addplot.htm

            I would recommend you use your own plot name instead of trying to use NInjaTrader's internal resources (used for language translations with system indicators).
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thank you

              Got it to work!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by jeronymite, Today, 09:26 PM
              0 responses
              6 views
              0 likes
              Last Post jeronymite  
              Started by ttodua, Yesterday, 06:45 AM
              2 responses
              17 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by franco12364, Today, 08:08 PM
              2 responses
              10 views
              0 likes
              Last Post franco12364  
              Started by smcllr, Today, 06:10 PM
              1 response
              16 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by lupearadu, Today, 01:58 PM
              7 responses
              38 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X