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

Woodies CCI "indicator" error CS0542

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

    Woodies CCI "indicator" error CS0542

    hey there,

    I've been learning JavaScript and in turn C# for some type, to aid in my indicator/strategy development in NinjaTrader and I think I've made strides, where my only limitations are now figuring out what I actually want to be done, and not how to do it.

    I'm saying that because it's not an issue with my code, as far as I know. In fact, nothing changed from October 11th to October 12th, outside of restarting my computer, and when I opened up NinjaTrader again and opened up Editor looking to add some code, I'm getting an error on an indicator that is a BUILT IN, and I made no modifications. Any idea why this is happening?

    NinaTrader\WoodiesCCI.cs - 'Indicator':member names cannot be the same as their enclosing type - CS0542 - Line 124 & Line 129 - Column20

    "
    #region NinjaScript generated code. Neither change nor remove.

    namespace NinjaTrader.NinjaScript.Indicators
    {
    public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
    {
    private Indicator[] cacheIndicator;
    public Indicator Indicator()
    {
    return Indicator(Input);
    }

    public Indicator Indicator(ISeries<double> input)
    {
    if (cacheIndicator != null)
    for (int idx = 0; idx < cacheIndicator.Length; idx++)
    if (cacheIndicator[idx] != null && cacheIndicator[idx].EqualsInput(input))
    return cacheIndicator[idx];
    return CacheIndicator<Indicator>(new Indicator(), input, ref cacheIndicator);
    }
    }
    }
    "
    Last edited by lmatiukas; 10-12-2017, 10:50 AM.

    #2
    Hello lmatiukas,

    Thanks for writing in.

    Where did you copy this NinjaScript generated code from? Creating an indicator called "Indicator" will result in uncompileable code, however I would be curious as to why this would be reporting through WoodiesCCI.cs.

    WoodiesCCI resides in the Documents\NinjaTrader 8\bin\Custom\NinjaTrader.Vendor.dll assembly. If close NinjaTrader, delete this file and restart NinjaTrader, do you still encounter the error when you compile your custom NinjaScript assembly?

    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jim; 10-12-2017, 11:40 AM.
    JimNinjaTrader Customer Service

    Comment


      #3
      hey there,

      yep it's copied from that file, and it clearly looks like a system file; I cannot modify it seemingly, even if I wanted to. If I delete the file, would it self-populate, since I am referencing to it with my strategy?

      I guess I could copy everything in it, and make my own indicator, it just looks like not a full indicator, and if I make changes, I'm not 100% that it would work.

      Is it "safe" to delete it thus?

      Thanks

      Comment


        #4
        Hello lmatiukas,

        The Documents\NinjaTrader 8\bin\Custom\NinjaTrader.Vendor.dll file will be recreated when you restart NinjaTrader.

        I am still unclear as to where you copied the NinjaScript generated code from. Is a new .cs file being created for WoodiesCCI that includes this mentioned code, and only this mentioned code? WoodiesCCI resides in the Vendor assembly as it is closed source. I would not expect an additional .cs file to be created for this as NinjaTrader includes a reference to this assembly and the assembly ships with NinjaTrader.

        If you see this then please right click on the file in the NinjaScript Explorer (right hand side of the NinjaScript Editor) and select "Exclude from Compilation" and rebuild your indicator.

        If this is not the case and closing NinjaTrader, deleting the Vendor assembly and then restarting NinjaTrader does not resolve this issue, I would like to get connected to better observe the issue at hand.

        If we need to cross that bridge, please reach out to me at platformsupport [at] ninjatrader [dot] com with the thread URL and "Attention Jim." Please also include a time (including your time zone) where we could schedule a remote support session. Our regular support hours are 8:30am to 6pm US Eastern, Monday through Friday.

        * Shortly before our call, please launch our remote support application (TeamViewer). There are 2 ways you can do this.

        * Via NinjaTrader Control Center > Help > Remote Support
        * If you cannot start or have not downloaded NinjaTrader, please download the support application here: http://www.ninjatrader.com/support/NTSupport.exe

        I look forward to being of further assistance.
        JimNinjaTrader Customer Service

        Comment


          #5
          Super odd

          So you are correct, in that I made an additional file.
          I copied over the partially available script and made a "WoodiesCCI.cs" file and placed it into the indicator folder, so I could use it and refer to it, in my strategy.

          WoodiesCCI shows up as an indicator when looking to place it on the chart, but when typing "WoodiesCCI" (even though intelisense provides a reference to it) in a strategy, this happens:
          I get "WoodiesCCI is a 'type' but is used like a 'variable'" CS0118 fault.

          My reasonable solution was to copy the partial code and create WoodiesCCI and place it in "INDICATORS" folder; I didn't think much of it, since it worked, and since it's a LEADING indicator, it helped with my strategy accuracy greatly, just now WEEKS later, I get this fault, even though nothing has changed.

          ^^ That is the ODD thing right there. If I'm having essentially two files referencing to the same things, why doesn't it give me a fault way before. I can use the strategy as is, without any changes, since it's already compiled a version before the fault; but I would like to make slight changes while keeping CCI.

          How to reference to CCI, if the actual name that is given under the "partial indicator" is a reference: "NinjaTrader.Gui.NinjaScript.IndicatorRenderBa se"

          Thanks

          Comment


            #6
            Hello lmatiukas,

            Thanks for the additional detail.

            You should not need to create a new indicator to use WoodiesCCI in your code.

            I have attached a sample strategy that adds a WoodiesCCI indicator to a strategy and prints the values of each plot.

            Could you remove your created WoodiesCCI indicator and your strategy that uses it from compilation and then import the strategy I have attached?

            If you can enable the strategy and see the indicator without issue, this tells us there is an issue with the syntax of your code. The syntax in the sample could be referenced for you to implement the correct syntax in your code.

            If this strategy does not work, this tells us there is an issue with your installation and I would then advise to download an installer from our website and uninstall and reinstall NinjaTrader 8. This process will leave the Documents/NinjaTrader 8 folder in tact and your workspaces, templates, NinjaScripts, and data will be preserved.

            An installer can be downloaded here: https://ninjatrader.com/PlatformDirect

            I look forward to being of further assistance.
            Attached Files
            JimNinjaTrader Customer Service

            Comment


              #7
              hey there,

              thanks - I'll try reinstalling. I get the same issue as before with my code when I had both - "NinjaTrader.NinaScript.Indicators.WoodiesCCI' is a 'type' but is used like a 'variable' - CS0118 - Line 62 - Column 22.

              Still super strange, because as you see I was NEVER able to reference WoodiesCCI that is built in, so that's why I made my own indicator that copied over the code; like I said that worked for almost 2+ weeks until one day it just didn't.

              Thanks again for helping out.

              Comment


                #8
                I have to share, that without changing anything. Simple uninstalling it, and installing it, it now works again.

                Also, it idles at about 300MB less, at around 650MB, vs 950MB of ram. I've been watching TaskBar a lot, in midst of these crashes, so that number has been etched in my eyeballs.

                Odd stuff, but working now.

                thanks

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bortz, 11-06-2023, 08:04 AM
                47 responses
                1,607 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                9 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                19 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                6 views
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                15 views
                0 likes
                Last Post Javierw.ok  
                Working...
                X