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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        164 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        319 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        246 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        350 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        179 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X