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 inanazsocial, Today, 01:15 AM
          0 responses
          2 views
          0 likes
          Last Post inanazsocial  
          Started by trilliantrader, 04-18-2024, 08:16 AM
          5 responses
          22 views
          0 likes
          Last Post trilliantrader  
          Started by Davidtowleii, Today, 12:15 AM
          0 responses
          3 views
          0 likes
          Last Post Davidtowleii  
          Started by guillembm, Yesterday, 11:25 AM
          2 responses
          9 views
          0 likes
          Last Post guillembm  
          Started by junkone, 04-21-2024, 07:17 AM
          9 responses
          71 views
          0 likes
          Last Post jeronymite  
          Working...
          X