Announcement

Collapse
No announcement yet.

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?

    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!

        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

            Comment


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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              637 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              366 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              107 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              569 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              572 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X