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 Jonker, Today, 01:19 PM
          0 responses
          1 view
          0 likes
          Last Post Jonker
          by Jonker
           
          Started by futtrader, Today, 01:16 PM
          0 responses
          5 views
          0 likes
          Last Post futtrader  
          Started by Segwin, 05-07-2018, 02:15 PM
          14 responses
          1,790 views
          0 likes
          Last Post aligator  
          Started by Jimmyk, 01-26-2018, 05:19 AM
          6 responses
          838 views
          0 likes
          Last Post emuns
          by emuns
           
          Started by jxs_xrj, 01-12-2020, 09:49 AM
          6 responses
          3,294 views
          1 like
          Last Post jgualdronc  
          Working...
          X