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

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.


            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 kujista, Today, 05:44 AM
              0 responses
              6 views
              0 likes
              Last Post kujista
              by kujista
               
              Started by ZenCortexCLICK, Today, 04:58 AM
              0 responses
              8 views
              0 likes
              Last Post ZenCortexCLICK  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              172 responses
              2,281 views
              0 likes
              Last Post sidlercom80  
              Started by Irukandji, Yesterday, 02:53 AM
              2 responses
              18 views
              0 likes
              Last Post Irukandji  
              Started by adeelshahzad, Today, 03:54 AM
              0 responses
              9 views
              0 likes
              Last Post adeelshahzad  
              Working...
              X