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

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.
    BertrandNinjaTrader Customer Service

    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
        BertrandNinjaTrader Customer Service

        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
              BertrandNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Tim-c, Today, 02:10 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Taddypole, Today, 02:47 PM
              0 responses
              2 views
              0 likes
              Last Post Taddypole  
              Started by chbruno, 04-24-2024, 04:10 PM
              4 responses
              50 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              10 responses
              399 views
              1 like
              Last Post beobast
              by beobast
               
              Started by lorem, Yesterday, 09:18 AM
              5 responses
              25 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X