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

Exposing indicator enum

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

    Exposing indicator enum

    Hi,
    I have a very simple enum defined in my indicator as shown:

    publicenum TradeDirection
    {
    Long =
    1,
    Short =
    2
    }

    For some reason, I can't seem to reference it in a strategy.
    Is there some secret sauce I need to expose this for use in other indicators/strategies?
    Thanks ... Ed


    #2
    Hello edstaffin,

    What name space is the public enum declared in?

    Is this in the Strategy namespace or the Indicator namespace?

    In other words the enum is likely not in the right scope.
    http://www.codecandle.com/articles/c...ble-scope.html

    (put this enum in the UserDefinedMethods.cs file in Documents\NinjaTrader 7\bin\Custom\Strategy so that it is within the Strategy namespace)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      Thanks for the quick reply. I am very familiar with namespaces.
      Shouldn't I be able to ref the enum with a fully qualified reference ...

      if(MyIndicatorVariable.SomePropertyThatIsATradeDir ectionEnum ==
      NinjaTrader.Indicator
      .MyIndicatorType.TradeDirection.Long)
      // do something interesting;

      Thanks ... Ed

      Comment


        #4
        Hi Ed,

        As long as the enum is within that particular indicators' class' scope then yes you should be able to access that enum.

        At this point I would need to test a sample to understand the issue.

        Can you put together a simplifed test script to demonstrate?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi,
          It turns out there was a bit of brain damage on my part. I started typing in MyIndicator. and didn't get the intellisense so I assumed there was something wrong. If I continue typing MyIndicator.TradeDirection. I get the intellisense and all is well.
          Thanks for your time and sorry to have wasted it!
          Ed

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          19 views
          0 likes
          Last Post algospoke  
          Started by ghoul, Today, 06:02 PM
          3 responses
          14 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          45 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          21 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by AttiM, 02-14-2024, 05:20 PM
          10 responses
          181 views
          0 likes
          Last Post jeronymite  
          Working...
          X