Announcement

Collapse
No announcement yet.

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 samir, Today, 07:00 PM
          0 responses
          9 views
          0 likes
          Last Post samir
          by samir
           
          Started by travisloneker, Today, 06:52 PM
          0 responses
          6 views
          0 likes
          Last Post travisloneker  
          Started by InfraredBusa, Today, 05:50 PM
          0 responses
          3 views
          0 likes
          Last Post InfraredBusa  
          Started by White Fork, Today, 04:56 PM
          1 response
          8 views
          0 likes
          Last Post White Fork  
          Started by steveyinyang, Today, 02:48 PM
          3 responses
          22 views
          0 likes
          Last Post steveyinyang  
          Working...
          X