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 jclose, Today, 09:37 PM
          0 responses
          5 views
          0 likes
          Last Post jclose
          by jclose
           
          Started by WeyldFalcon, 08-07-2020, 06:13 AM
          10 responses
          1,414 views
          0 likes
          Last Post Traderontheroad  
          Started by firefoxforum12, Today, 08:53 PM
          0 responses
          11 views
          0 likes
          Last Post firefoxforum12  
          Started by stafe, Today, 08:34 PM
          0 responses
          11 views
          0 likes
          Last Post stafe
          by stafe
           
          Started by sastrades, 01-31-2024, 10:19 PM
          11 responses
          169 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X