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 Tim-c, Today, 03:54 AM
        0 responses
        3 views
        0 likes
        Last Post Tim-c
        by Tim-c
         
        Started by FrancisMorro, Today, 03:24 AM
        0 responses
        3 views
        0 likes
        Last Post FrancisMorro  
        Started by Segwin, 05-07-2018, 02:15 PM
        10 responses
        1,772 views
        0 likes
        Last Post Leafcutter  
        Started by Rapine Heihei, 04-23-2024, 07:51 PM
        2 responses
        31 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by Shansen, 08-30-2019, 10:18 PM
        24 responses
        945 views
        0 likes
        Last Post spwizard  
        Working...
        X