Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Indicators calling other Custom Indicators

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

    Custom Indicators calling other Custom Indicators

    I am writing a system and I am trying to divide up the logic.

    One custom indicator that computes moving average entry conditions has to call another custom indicator that tracks the bollinger entry conditions.

    How would I call my own custom indicator?

    Another related question:

    I know I can call the built in standard indicators in my custom script.

    But am I really calling methods on those indicators, or is it constructing the indicator on every call? That would seem expensive.

    Thanks in advance..

    #2
    DancesWithBears, just as you call other custom indicators as well for example -

    Code:
     
    double myCustomValue= MyCustomIndicator(Parameter1, Parameter2);
    An indicator automatically offers a method in NinjaScript, there's no function / indicator concept as in other trading software languages. The needed cache of indicator calls is done internally by NinjaTrader.

    Comment


      #3
      Think the sytax looks like this

      Bertrand,

      Think I got it right but you can please confirm.
      I construct a Custom Indicator object then call method on it.

      // in my other custom indicator body
      MyCustomerIndicator myCustomIndicator(Parameter1, Parameter2);

      myCustomIndicator.DoThis();
      myCustomIndicator.DoThat();

      I just wanted to avoid creating another instance of the indicator.
      But you are saying that the system won't if it sees the same constructor arguments that match an object already instantiated. (caches).

      Seems logical.


      Originally posted by NinjaTrader_Bertrand View Post
      DancesWithBears, just as you call other custom indicators as well for example -

      Code:
       
      double myCustomValue= MyCustomIndicator(Parameter1, Parameter2);
      An indicator automatically offers a method in NinjaScript, there's no function / indicator concept as in other trading software languages. The needed cache of indicator calls is done internally by NinjaTrader.

      Comment


        #4
        DancesWithBears, yes that is correct, you could also use the UserDefinedMethods for this purpose - http://www.ninjatrader-support.com/H...verview45.html

        Comment


          #5
          That was my next question and you already answered it.

          Tausend Dank! A thousand thanks! Thanks very much!

          Comment


            #6
            Problem exporting when I use

            Getting "error compiling sources" when I try to export now.
            After I put my functions in UserDefinedMethods.cs.

            hmm..

            Originally posted by NinjaTrader_Bertrand View Post
            DancesWithBears, yes that is correct, you could also use the UserDefinedMethods for this purpose - http://www.ninjatrader-support.com/H...verview45.html

            Comment


              #7
              Yes, unfortunately you can't export UserDefinedMethods

              Comment

              Latest Posts

              Collapse

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