Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to pass Primary DataSeries to Custom Method

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

  • NinjaTrader_ChelseaB
    replied
    Hello aventeren,

    The message you got is likely because you have your method set to accept a parameter.

    Try removing this.

    Leave a comment:


  • aventeren
    replied
    When I attempt to not pass a DataSeries to myMethod by doing this:

    Code:
    myMethod();
    I'm getting a No Overload for myMethod takes 0 arguments error.

    I then go back to trying to pass myMethod the Close DataSeries by doing this:

    Code:
    myMethod(Close);
    But then I get an error that says that I cannot convert from the 'NinjaTrader.Data.IDataSeries' to 'NinjaTrader.Data.DataSeries'. So it looks like Close is an IDataSeries type and the secondary series is defined as a DataSeries type. Is it possible to pass the primary DataSeries Close values as a NinjaTrader.Data.DataSeries type instead of as a .IDataSeries type?

    Leave a comment:


  • aventeren
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hello aventeren,

    The custom method will use which ever data series you call.

    Have you given this a test?
    I'm hunting errors (this is one of many), so I am not able to test.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello aventeren,

    The custom method will use which ever data series you call.

    Have you given this a test?

    Leave a comment:


  • aventeren
    replied
    Originally posted by NinjaTrader_ChelseaB View Post
    Hi aventeren,

    You may not need to pass the series.

    Have you tried printing the close of the current bar in the custom method without passing the data series?

    For example:

    protected void myMethod()
    {
    Print(Close[0]);
    }
    So if you leave the DataSeries field blank in a custom Method NT knows to use the primary DataSeries?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hi aventeren,

    You may not need to pass the series.

    Have you tried printing the close of the current bar in the custom method without passing the data series?

    For example:

    protected void myMethod()
    {
    Print(Close[0]);
    }

    Leave a comment:


  • aventeren
    started a topic How to pass Primary DataSeries to Custom Method

    How to pass Primary DataSeries to Custom Method

    Hello--

    I have created a secondary DataSeries (let's call it myDataSeries) and a custom Method that take a DataSeries as one of the parameters (let's call it myMethod(Dataseries targetDataSeries)).

    Some times I want to pass myDataSeries into myMethod by doing this:

    Code:
    myMethod(myDataSeries);
    However, sometimes I just want to pass the primary DataSeries to myMethod. I have attempted to do this with the following code, but I am getting an error:

    Code:
    myMethod(Close);
    What is the proper way to pass the primary DataSeries Close values to a custom Method?

    Thanks,

    Aventeren

Latest Posts

Collapse

Topics Statistics Last Post
Started by Hwop38, 05-04-2026, 07:02 PM
0 responses
174 views
0 likes
Last Post Hwop38
by Hwop38
 
Started by CaptainJack, 04-24-2026, 11:07 PM
0 responses
329 views
0 likes
Last Post CaptainJack  
Started by Mindset, 04-21-2026, 06:46 AM
0 responses
252 views
0 likes
Last Post Mindset
by Mindset
 
Started by M4ndoo, 04-20-2026, 05:21 PM
0 responses
356 views
0 likes
Last Post M4ndoo
by M4ndoo
 
Started by M4ndoo, 04-19-2026, 05:54 PM
0 responses
183 views
0 likes
Last Post M4ndoo
by M4ndoo
 
Working...
X