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

error CS0118 NinjaTrader.NinjaScript.Indicators.SMA is a type, but used as variable.

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

    error CS0118 NinjaTrader.NinjaScript.Indicators.SMA is a type, but used as variable.

    Hello, I am implementing indicator.
    And I get error everywhere , when I compare close[0] and value of SMA() indicator.
    What can be a problem?

    The weird is that when I am using indicator - everything is fine.!
    But when I try to export I get error in log file.


    Code:
    private bool current_trend_filter(AkSignalType signal_type)
            {
                bool result = true;
                switch (signal_type) {
                    case AkSignalType.Buy:
                        if (Close[0] < SMA(SlowSMAPeriod)[0])
                            result = false;
                        break;
                    case AkSignalType.Sell:
                        if (Close[0] > SMA(SlowSMAPeriod)[0])
                            result = false;
                        break;
                }
    
                return result;
            }

    #2
    Hello akushyn,
    Thanks for your post.

    The issue does not appear to be with any NinjaScript in this snippet.

    If you exclude this script from compilation are you able to export?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_JoshG View Post
      Hello akushyn,
      Thanks for your post.

      The issue does not appear to be with any NinjaScript in this snippet.

      If you exclude this script from compilation are you able to export?
      Hello, JoshG

      Thank you for the quick reply.
      So far, I have no other scripts in the scope.

      Could it be the issue with VirtualBox running NT8 export?

      Comment


        #4
        I've just tried .... create copy-paste SMA indicator as my custom indicator to try exporting the script.
        But indicator is avaliable only in Script Editor and not visible to add on chart or export.

        See attached picture.

        Comment


          #5
          akushyn,

          Your NinjaScript does not appear in the Indicators window because of your "Name" property inside OnStateChange()

          Can you find the NinjaScript once you change that property to the name you expect to find it under?
          Josh G.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_JoshG View Post
            akushyn,

            Your NinjaScript does not appear in the Indicators window because of your "Name" property inside OnStateChange()

            Can you find the NinjaScript once you change that property to the name you expect to find it under?
            When I comment Description and Name properties the indicator appears in the list.


            And I think it is a BUG with general question about exporting ERROR - can't export scripts from Virtual Machine.

            I've just copied to another notebook with Windows7 (not a virtual drive) and export works like a sharm.
            So, may be you can advise me some topics, how to run NinjaTrader8 on Linux Mint 19 ?

            Comment


              #7
              akushyn, I do not believe that this is a bug. I am able to compile my own custom method just fine when using the same logical comparison. ( Close[0] < SMA(SlowSMAPeriod)[0] )

              Linux is not supported by NinjaTrader, but I can submit your vote towards the open request for Linux support. The internal tracking number for that feature request is SFT-153. Please reference this internal tracking number if you ever have questions regarding this feature request.

              When a feature request is implemented, you'll find it in the release notes:



              Additionally, please write in to PlatformSupport(AT)NinjaTrader(DOT)com and reference this forum post with RE:JOSH in the subject line. Please attach your Log and Trace files to your email so that I may investigate this matter further. You may follow the steps below to attach those files.
              • Open your NinjaTrader folder under My Documents.
              • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
              • Send the 2 compressed folders as attachments to this email.
              • Once complete, you can delete these compressed folders.


              Josh G.NinjaTrader Customer Service

              Comment


                #8
                For anyone finding this post a few years later, I hit a similar issue today whereby often used indicators like EMA or ATR in existing strategies started throwing compile errors but only in certain batches of files. The issue for me was the parent folder name somehow clashing with the strategy name. For example, I created a folder within Strategies called MyStrat and then within that had a strategy named MyStratv1. If I renamed the folder to RandomStrat, the compile errors went away. There must be some special namespace pattern matching that happens under the hood that breaks references to these indicators when the folder name is too close to the strategy name.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by JackyP, 07-25-2023, 08:39 AM
                3 responses
                318 views
                0 likes
                Last Post Lancer
                by Lancer
                 
                Started by TiffanyMiller, Yesterday, 10:19 PM
                0 responses
                6 views
                0 likes
                Last Post TiffanyMiller  
                Started by algospoke, 05-13-2024, 06:53 PM
                12 responses
                138 views
                0 likes
                Last Post algospoke  
                Started by psangram, Yesterday, 06:35 PM
                0 responses
                6 views
                0 likes
                Last Post psangram  
                Started by Alaina19, 07-14-2024, 04:38 PM
                2 responses
                17 views
                0 likes
                Last Post Alaina19  
                Working...
                X