• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Creating custom functions

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

    Creating custom functions

    I have some custom indicators in NinjaScript. A user wants to be able to use the indicators in a strategy. Is there a way I can create a function he can call from the strategy and distribute this while still keeping the code protected?

    #2
    Hello dbtrader,

    Thanks for your post.

    You would want to export your indicators as assemblies to prevent access to the source code. The process is covered in the helpguide: http://ninjatrader.com/support/helpG...stribution.htm see the section, "Exporting NinjaScript Indicators or Strategies as Assembly"
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hi Paul,

      That doesn't quite answer my question. If the user wants to build a NinjaScript strategy based on the indicator how would he do that?

      Comment


        #4
        Hello dbtrader,

        Thanks for your reply.

        To use an indicator with a strategy you would use the method and the parameters.
        Here is an example using the simple moving average indicator SMA

        double smaoutput = SMA(20)[0]; // save current value of 20 period sma
        Print ("Currentbar:" +CurrentBar+" SMA(20) value: " +smaoutput);

        or to use the indicator directly in the string
        Print (("Currentbar:" +CurrentBar+" SMA(20) value: "+SMA(20)[0]);

        If you want to have the strategy also display the indicator, you would use the Add() method http://ninjatrader.com/support/helpGuides/nt7/?add2.htm
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Paul,

          I'm able to call SMA and other indicators, but not the custom indicator. What reason would cause the custom indicator to be unavailable?

          Comment


            #6
            Hello,

            Thanks for your reply.

            Without further information it would be difficult to say. I am assuming this is an indicator that you have created and exported with security discussed earlier in this thread. If you would like to you can send in your exported indicator and I will be glad to review adding it to a strategy. Send to PlatFormSupport[at]NinjaTrader[dot]Com with atten: Paul and link: http://ninjatrader.com/support/forum...ad.php?t=75585
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ajay8000, Yesterday, 11:31 PM
            2 responses
            10 views
            0 likes
            Last Post ajay8000  
            Started by simjs, Yesterday, 11:23 PM
            0 responses
            5 views
            0 likes
            Last Post simjs
            by simjs
             
            Started by akuntysh, Yesterday, 10:41 PM
            0 responses
            4 views
            0 likes
            Last Post akuntysh  
            Started by Wolf1, Yesterday, 08:26 PM
            0 responses
            7 views
            0 likes
            Last Post Wolf1
            by Wolf1
             
            Started by pparmley, Yesterday, 04:30 PM
            0 responses
            9 views
            0 likes
            Last Post pparmley  
            Working...
            X