Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 ageeholdings, 05-01-2024, 05:22 AM
        5 responses
        30 views
        0 likes
        Last Post ageeholdings  
        Started by reynoldsn, Today, 02:34 PM
        0 responses
        6 views
        0 likes
        Last Post reynoldsn  
        Started by nightstalker, Today, 02:05 PM
        0 responses
        10 views
        0 likes
        Last Post nightstalker  
        Started by llanqui, Yesterday, 09:59 AM
        8 responses
        29 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by quicksandatl, Today, 01:39 PM
        1 response
        6 views
        0 likes
        Last Post quicksandatl  
        Working...
        X