Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

use a parametre of an Indicator in a Strategy

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

    use a parametre of an Indicator in a Strategy

    Hi,

    I have a stupid problem :
    I have a simple indicator EssaiIndic
    witch contain a parametre a single courbe
    Plot0.Set(Close[0]);
    here is no problem

    but in a simple srtategy : essStrategy1
    how can i use Plot0 of EssaiIndic ?

    if ((EssaiIndic.Plot0 ) > (Val))
    { }
    it doesn t work (CS0119)

    Thanks for all

    #2
    Hello Pcomm69,

    Thanks for your note.

    The way to access a plot value from another script is like the following:

    if (EssaiIndic().Plot0[0] > Val)
    {
    // execute code
    }

    The indicator will be called as a method and will need the parenthesis following the indicator name. If you would like a specific value, such as the last value, you will need to add a bars ago value such as [0]. Without, this will return the entire dataseries (as a dataseries and not a value).

    This is assuming there are no properties for this plot (if there are they will need to be added to the call for example EssailIndic(0).Plot0[0]).

    Also, as a side note, the indicator wizard will create a public variable for your Plot0. If this has been removed it will need to be re-added. This is in the properties section. Ignore this if you have not manually removed this.

    [Browsable(false)]
    [XmlIgnore()]
    public DataSeries Plot0
    {
    get { return Values[0]; }
    }


    Let me know if this does not resolve your inquiry.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks
      all is good

      I know that,

      [Browsable(false)]
      [XmlIgnore()]
      public DataSeries Plot0
      {
      get { return Values[0]; }
      }
      i ll be put it

      but wich is the precise difference between
      get { return Values[0]; }
      and
      get { Update(); return Values[0]; }

      Comment


        #4
        Hello,

        The Update() method refreshes the chart.

        I imagine that this would refresh the chart before returning your value.

        However, I have never seen this in particular coded this way before.

        I recommend you try with and without. My guess is it will be exactly the same.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          and just a question i have 3 parameters in EssailIndic ?
          does it :
          EssailIndic(0,0,0).Plot0[0])
          or
          EssailIndic(0),(0),(0).Plot0[0]

          with3 good declaration like that in Properties
          [Gui.Design.DisplayName ("Daily ATR Length")]
          [Category("Parameters")]
          public int DailyATRLength
          {
          get { return dailyatrlength;}
          set { dailyatrlength = Math.Max(1, value); }
          }

          Comment


            #6
            Hi Pcomm69,

            The proper use for 3 parameters would be:

            EssailIndic(0,0,0).Plot0[0]
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by Pcomm69 View Post
              Thanks
              all is good

              I know that,

              [Browsable(false)]
              [XmlIgnore()]
              public DataSeries Plot0
              {
              get { return Values[0]; }
              }
              i ll be put it

              but wich is the precise difference between
              get { return Values[0]; }
              and
              get { Update(); return Values[0]; }
              You should not need to run Update() in the getter of a Plot. It is for ensuring that you get the correct current value for any exposed variable this is not a Plot.

              Comment


                #8
                koganam,

                Thank you very much for your input here.

                I have now learned this as well.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                646 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                367 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                107 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                569 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                573 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X