Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Enum

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

    Enum

    I think I am making an error here or it may be a bug reagarding enums.

    I set the enum up like so..
    Code:
    public enum BaseCurrency
    {
    		BritishPound,
    		USDollar,
    		JapaneseYen,
    		SwissFranc,
    		NZD,
    		Euro
    }
    public BaseCurrency mybase = BaseCurrency.BritishPound;
    when I add below in the properties section it returns an error
    the type or namespace name 'BaseCurrency' could not be found( are you missing a using directive or an assembly reference.

    Code:
    		
           [GridCategory("Param1")]
    		[NinjaTrader.Gui.Design.DisplayName("Base Currency Denom")]
    		public BaseCurrency mybase
    		{
    	   get { return mybase; }
               set { mybase = value; }
    		}
    If I remove this last section of code the indicator runs but I do not have the enum in the parameters box.

    I feel I am being stupid here but I just can't see it.

    #2
    This is standard C# programming support you needed, which is beyond the support we provide.

    However: this user here tried something similar. You may want to inspect his code in post #11.

    Comment


      #3
      thanks for the direction

      on another note - I had a freeze up with IB and NT7 today - what TWS should I be using with this beta?

      Comment


        #4
        Always the one which we have on the connection guide http://www.ninjatrader.com/webnew/su...ivebrokers.htm

        Comment


          #5
          ah

          Ok that is the one I have.

          I had this before with 6.5. When there is a sustained burst of activity eg economic figures my t&s on the FDAX future just keeps repeating the same price and the chart no longer updates.
          If I close the t&s after a few seconds the chart corrects itself.

          I can't see anything in the trace file but I attach it anyway - the problem occurred at around 1330-1335

          Comment


            #6
            You did not attach the trace file.

            Strange, T&S windows in NT7 works very different than in NT6.5

            Comment


              #7
              Mindset,

              Where is the ENUM defined? It needs to be prior to the namespace of the indicator / strategy. I suggest creating a dummy "global" empty indicator / strategy just to define the enums so they are available to all indicators / strategies.
              mrlogik
              NinjaTrader Ecosystem Vendor - Purelogik Trading

              Comment


                #8
                file is too large

                and no matter how much I chop it down it's still too large (33 kb) is about as small as I can get it - but literally it is all just account update requests.
                except for this (note the gap in time)
                I did NOT lose my connection to IB which this implies as I had to revert to IB' s own chart whilst NT sorted itself out.

                2010-01-14 13:28:17:158 (Russell) Cbi.AccountUpdateEventArgs.Process: Account='U89887' ItemType='NetLiquidationByCurrency' Currency='UsDollar' Value=*****
                2010-01-14 13:30:20:423 (Russell) IB.Adapter.HandleMessage DataFarmConnectionOk
                2010-01-14 13:31:16:861 (Russell) IB.AccountUpdatesRequest.ProcessUpdate: version=2 account='U89887' stringItem='Cushion' stringValue='*****' stringCurrency=''

                Comment


                  #9
                  enum

                  Originally posted by mrlogik View Post
                  Mindset,

                  Where is the ENUM defined? It needs to be prior to the namespace of the indicator / strategy. I suggest creating a dummy "global" empty indicator / strategy just to define the enums so they are available to all indicators / strategies.

                  Well following Dierk's example I moved my enum definitions to the very end of the code and prior to the stuff that is generated by NT.
                  I did read about setting enums above the namespace but then aslane commented that it may cause some confusion.
                  Suffice to say it is now working and doing it's thing.

                  I like your idea of a global enum ... but right now I have my hands full trying to convert stuff to NT7.

                  Comment


                    #10
                    Okay,

                    The Global file is good, but any time you export something that relies on a global enum, you have to export that global indicator as well.

                    Just something to keep in mind.
                    mrlogik
                    NinjaTrader Ecosystem Vendor - Purelogik Trading

                    Comment


                      #11
                      Hint: For the particular enum below check out Cbi.Currency.

                      Disclaimer: Not supported...

                      Comment


                        #12
                        Why don't you constract it like normal vars:
                        private BaseCurrency mybase = BaseCurrency.BritishPound;

                        [GridCategory("Param1")]
                        [NinjaTrader.Gui.Design.DisplayName("Base Currency Denom")]
                        public BaseCurrency Mybase
                        {
                        get { return mybase; }
                        set { mybase = value; }
                        }

                        Baruch
                        p.s.
                        Look at the colored text!

                        Comment


                          #13
                          Good catch Baruch. That is the better way to do it.
                          mrlogik
                          NinjaTrader Ecosystem Vendor - Purelogik Trading

                          Comment


                            #14
                            So close

                            Originally posted by Baruch View Post
                            Why don't you constract it like normal vars:
                            private BaseCurrency mybase = BaseCurrency.BritishPound;

                            [GridCategory("Param1")]
                            [NinjaTrader.Gui.Design.DisplayName("Base Currency Denom")]
                            public BaseCurrency Mybase
                            {
                            get { return mybase; }
                            set { mybase = value; }
                            }

                            Baruch
                            p.s.
                            Look at the colored text!
                            Yes much happier with that Baruch - thanks.
                            I think Dierk is referring to

                            Instrument.MasterInstrument.InstrumentType == Cbi.InstrumentType.Currency);

                            I have never been able to fathom out cbi - not actually sure what it even stands for? Anyway - this returns a type and not what I was looking for.

                            Comment


                              #15
                              I was referring to the fact that there is not for a custom enum BaseCurrency as you could use Cbi.Currency.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              602 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              347 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              560 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              559 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X