Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

UserDefinedMethods - calling Multi-time frame

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

    UserDefinedMethods - calling Multi-time frame

    Hi there

    I want to use the same bar objects in the UserDefinedMethod file so my indicators can access the methods.

    Am I able to do that without Initialize to Add the Bars Object?

    I have never tried because of that and keep adding the same bar objects to different indicators...

    IJ

    #2
    Hello IJ,

    Initialize() will not be ran inside of the UserDefinedMethods by default. You may want to create a custom method that takes a variable that you can pass the method and then have it do some calculations and then return a value for example:

    Code:
    public double ThisIsATest(double testVariable)
    {		
    	double returnVariable = testVariable * ATR(7)[0];
    	return returnVariable;
    }
    JCNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_JC View Post
      Hello IJ,

      Initialize() will not be ran inside of the UserDefinedMethods by default. You may want to create a custom method that takes a variable that you can pass the method and then have it do some calculations and then return a value for example:

      Code:
      public double ThisIsATest(double testVariable)
      {        
          double returnVariable = testVariable * ATR(7)[0];
          return returnVariable;
      }

      Thanks JC.

      Is there an example somewhere with bar objects that pass in a method?

      That would work then in the indicator it can initialize the bars object??

      Comment


        #4
        Originally posted by ij001 View Post
        Hi there

        I want to use the same bar objects in the UserDefinedMethod file so my indicators can access the methods.

        Am I able to do that without Initialize to Add the Bars Object?

        I have never tried because of that and keep adding the same bar objects to different indicators...

        IJ
        1. In your UserDefinedMethods file, create a method to add the Bars Series.
        2. Call the method in the Initialize() method of your indicators.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        596 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 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
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        554 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X