Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Pass DataSeries to Custom Indicator?

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

    How to Pass DataSeries to Custom Indicator?

    I am wondering if it is possible to pass a DataSeries to a Custom Indicator.

    If so, can you please point me to an example?

    I have been trying to do the following
    Code:
            
          #region Variables
    				private DataSeries 		highRef; 	
          
          protected override void Initialize()
          {
    		      highRef 		= new DataSeries(this) ;
          }
          
          #region Properties
    	[Browsable(false)]
            [XmlIgnore()]		
            public DataSeries HighRef
          {
             get { return highRef; }
    	set { highRef.Set(Values); } 
           }


    Thanks,
    ATC
    Last edited by tornadoatc; 02-28-2013, 10:01 AM.

    #2
    Hello ATC,

    By default NinjaTrader will automatically add an overload method that will take a Data Series that can be used your calculations along with all of your other User Defined Variables. See attached image.

    Will that be able to work with what you are trying to accomplish?
    Attached Files
    JCNinjaTrader Customer Service

    Comment


      #3
      I am wondering if more than one (the default) DataSeries can be passed into class ...

      Lets say I want my Indicator to work with two DataSeries called HighRef and LowRef but sometimes I want the HighRef to be based on High and sometimes I want HighRef based on High + 2*ATR(14) . LowRef would be similar, so want to pass in two DataSeries .

      Otherwise I am thinking I could use an int variable and put the logic in the indicator saying something like:
      Code:
      if (highRefType == "H+ATR") HighRef.Set(High[0] + 2 * ATR(14)[0]) ;
      etc ..
      Last edited by tornadoatc; 02-28-2013, 11:24 AM.

      Comment


        #4
        Hello ATC,

        You may use the IDataSeries to be able to pass an array of prices such as a DataSeries to an Indicator. Our Help Guide has an example of this that you may view at the link below.



        Let us know if we can be of further assistance.
        JCNinjaTrader Customer Service

        Comment


          #5
          Hello JC,

          Is there any way to pass an iDataSeries into Indicator as a Parameter?

          Code:
          		#region Variables 
                          private IDataSeries i_HighRef ; 
          
          
                          [Description("High Reference for Stop Calculations")]
          		[Category("Stop Parameters")]
          		[Gui.Design.DisplayNameAttribute("\t High Reference for Stop Calculations")]
          		public IDataSeries I_HighRef
          		{
          			get { return i_HighRef; }
          			set { i_HighRef = (IDataSeries) value; }  // ???????? 
          		}
          Also, there doesn't seem to be a way to pass in High[0]. Say I change the above to a double. But when I try to enter value for double parameter I can't enter High[0].

          Click image for larger version

Name:	ScreenHunter_01 Mar. 01 12.11.gif
Views:	1
Size:	3.7 KB
ID:	867041
          Last edited by tornadoatc; 03-01-2013, 11:14 AM.

          Comment


            #6
            Hello tornadoatc,

            There would not be a supported way to pass a DataSeries or IDataSeries as a User Defined Parameter. You would have to use a custom method as shown in the example of the IDataSeries Help Guide.
            JCNinjaTrader Customer Service

            Comment


              #7
              you can pass it like a string and then inside code parse the string to the type you want to use.

              Comment

              Latest Posts

              Collapse

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