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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        81 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        43 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        68 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        56 views
        0 likes
        Last Post CarlTrading  
        Working...
        X