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 junkone, Today, 11:37 AM
              0 responses
              2 views
              0 likes
              Last Post junkone
              by junkone
               
              Started by quantismo, 04-17-2024, 05:13 PM
              5 responses
              34 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by proptrade13, Today, 11:06 AM
              1 response
              6 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by love2code2trade, 04-17-2024, 01:45 PM
              4 responses
              34 views
              0 likes
              Last Post love2code2trade  
              Started by cls71, Today, 04:45 AM
              2 responses
              10 views
              0 likes
              Last Post eDanny
              by eDanny
               
              Working...
              X