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 help

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

    Error help

    Hi, I have modified an indicator that Paul wrote, called MACrossBuilderV1.06. It is working fine except for one thing. Please see the attached pics. Looking at the NT8Script pic, I have marked in red the problematic code. If I comment it out the indicator compiles and works, providing I don't need to use any of the enums. I have been through the code numerous times and am unable to spot the problem. I was going to export and send you the file, however it wouldn't export because of the problem, please see the log error pic.
    Can you give me any ideas on what to do please?
    Attached Files

    #2
    Hello KennyK,

    Thanks for your post.

    Enums have to be unique and that is why you would have to comment them out or alternatively change them slightly (and all corresponding code references to CDMAtype andDrawSelection).

    You wrote, "If I comment it out the indicator compiles and works...", what specifically happens in the indicator panel when you try to select either moving average or draw selection?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      HI Paul, I just had a look at that, the different CDMA types are present when the UI drop down is clicked. And they apply to the chart with no problem.
      I didn't test the DrawSelection, because I have commented all the code out that relates to it because I am not using it yet. But I assume it would be there the same as the CDMAtypes.
      I have commented out all the code that isn't relevant to the core of what I need. Until I get it working properly for the core. Then I will bring back one function at a time that I want to use.

      So having tested that, why is it so? Why does the original MACrossBuilder not have the same issue? How do I fix it?

      BTW, If your the Paul that provided the MACrossBuilder thanks very much!
      I have just added a 3rd MA and plotted the 3 in a separate window to show the difference between. And have added a second lot of color regions to suit.
      Thanks, Ken.

      Comment


        #4
        Hi KennyK,

        Thanks for your reply.

        The MACrossbuilder contains the enums that have to be unique and as your indicator has commented those out there is no longer an issue with duplicates as your indicator is accessing the enums in the MACrossbuilder. If you note where these enums are you will see they are not actually in the indicator but above the namespace NinjaTrader.NinjaScript.Indicators and any indicator can access and use those enums. The only issue would be if you exported your indicator to use elsewhere and in that case, you can simply uncomment the enums and you would be good to go on the target PC
        .
        Glad you like the indicator and you are welcome!
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          AH, I see now, thanks for explaining that Paul, I appreciate it.
          So if I am understanding correctly, If I comment them out in MACrossBuilder, I would then have to uncomment them in my indicator?
          Correct?

          I have now actually tested the above and found it to be correct.
          Which now poses another question. If the enums were moved inside the indicators namespace, would they then be private? Only accessible by the host indicator? Is this doable?
          Last edited by KennyK; 02-27-2019, 04:57 PM. Reason: Added comment

          Comment


            #6
            Hello KennyK,

            Thanks for your reply.

            Yes correct and glad you tested to confirm for yourself.

            Enums cannot be made private, here is an external reference that to help with understanding enum and its usage: https://csharp-station.com/Tutorial/CSharp/Lesson17

            Also, here is a link to an example of enums in NinjaTrader: https://ninjatrader.com/support/help...ned_parame.htm

            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Thanks Paul for the assistance, have a great day.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by cmtjoancolmenero, Yesterday, 03:58 PM
              1 response
              17 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by benmarkal, Yesterday, 12:52 PM
              3 responses
              23 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by helpwanted, Today, 03:06 AM
              1 response
              20 views
              0 likes
              Last Post sarafuenonly123  
              Started by Brevo, Today, 01:45 AM
              0 responses
              12 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              244 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Working...
              X