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

EXPORT issue

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

    EXPORT issue

    Hi,
    can you tell me how to solve the problem mentioned here, with SMA ?



    my indicator does the same failure only with SMA. Why that happens?
    Last edited by ttodua; 03-30-2019, 01:50 AM.

    #2
    Hello TazoTodua,

    Thank you for your note.

    Without the full code we're unable to test on our end.

    If you'd like to upload the full code I can take a look and see if anything jumps out. Or if you'd prefer to email a copy, send to platformsupport[at]ninjatrader[dot]com with Attn: Alan P in the Subject line. Also within the email please include a link to this thread, and the files.

    Please also include the log and trace files.

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      AlanP, here is a simple test, you can reproduce and finally see the problem, that frustratest many of us:

      just create a new indicator, and in OnBarUpdate, add this line:

      double smth = base.TMA(14)[0];

      compile, and try to export the script. you will get error.

      then, before that line, add this line:

      NinjaTrader.NinjaScript.Indicators.TMA x = null;

      compile, try to export - YOU WILL GET IT TO WORK (it successfully proceeds, and asks you to include the TMA or not).

      BUT if you will do the same steps for LinReg (or EMA or SMA), you will fail. even doing the mentioned "workaround"...

      So, actually, there is two problems:
      1) NT cant automatically include (during export) the files that are preceded with `base.` keyword. So, please fix that, as all „based" scripts were marked to be included.

      2) after that, check some indis, like EMA, LINREG, SMA (and some other I dont tested), why even declaring the Type doesnt help the exporter tool, to resolve them? (like i showed above).

      Comment


        #4
        Hello TazoTodua,

        In your indicator if you use,

        Code:
        double smth = TMA(14)[0];
        instead of,

        Code:
        double smth = base.TMA(14)[0];
        The script compiles and exports with no issue.

        Using base before the indicators name is not the supported method of writing an indicator.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          1) can you tell me then, why in many indicators, the other indicators are called with `base.`prefix? why the programmers do that in such manner? ( i see bunch of scripts doing that)

          2) I talked about SMA/EMA , LINREG problem.
          Why cant you tell me two words about them? why declaration of the type doesnt solve the problem for them, while it solves for others?

          Comment


            #6
            Hello TazoTodua,

            1) For stock scripts this should not be the case, if you do have an example could you provide it for me to review that specific use case? In general using base should only be used when you actually need to reference the base class which in this case you don't. Its possible those other scripts do, we would need a specific example if this is the question at hand or comparing that script versus your use.

            2), again using the incorrect keyword can cause problems in NinjaScript as you are not only using standard C# here. The base modifier should only be used when you access the base class. NinjaScript indicators are not setup to require you to use base. so it should not be used in this use case. For more information on base, please see https://docs.microsoft.com/en-us/dot.../keywords/base

            If you have some kind of custom inheritance in your script where you do actually need to use base., that would be a situation that we would likely suggest to avoid as custom inheritance is not something we can support.

            I look forward to your reply.
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by stafe, 04-15-2024, 08:34 PM
            7 responses
            31 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by adeelshahzad, Today, 03:54 AM
            4 responses
            29 views
            0 likes
            Last Post adeelshahzad  
            Started by merzo, 06-25-2023, 02:19 AM
            10 responses
            823 views
            1 like
            Last Post NinjaTrader_ChristopherJ  
            Started by frankthearm, Today, 09:08 AM
            5 responses
            17 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            43 views
            0 likes
            Last Post jeronymite  
            Working...
            X