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

Enum : Probems

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

    Enum : Probems

    i have the following code in my strategy :

    public class TrendMultiframeTs3 : Strategy
    ......
    switch (type)
    {
    case TypePeriod.Day:
    {Add(PeriodType.Day, period);
    break ;
    }

    .....
    Properties :

    [Description("Type Periodo del multiframe")]
    [GridCategory("Multiframe")]
    [Gui.Design.DisplayName("PeriodType")]
    public TypePeriod Type
    {
    get { return type; }
    set { type = value; }
    }


    To define TypePeriod I made a indicators:

    namespace NinjaTrader.Indicator
    {
    public enum LucaPeriodType //added to isolate enum (copiato da un indicatore)
    {
    Day,
    Minute,
    Range,
    Second,
    Tick,
    Volume,
    }
    }


    IS CORRECT? ...because i have problem to export the above strategy

    #2
    Turbofib,

    What is the error message you receive when trying to export?
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      ERROR cs0246 :
      impossible to find the type or the name space of the names "TypePEriod
      Probably missing a using directive or an assembly reference

      Comment


        #4
        Turbofib,

        Can you please send me your files that you are using for this?

        You can find them in (My) Documents -> NinjaTrader 7 -> bin -> custom -> Strategy and Indicator.
        Last edited by NinjaTrader_CalH; 01-28-2014, 07:24 AM.
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          i don't understand you answer

          Comment


            #6
            Turbofib,

            Please see my updated post #4
            Cal H.NinjaTrader Customer Service

            Comment


              #7
              Here is the strategy and indicator

              strategy have reduced ... I left only the essential
              Attached Files

              Comment


                #8
                Turbofib,

                is there a reason that you are creating a public enum for Period Types?

                NinjaScript already has the ability to test for different period types -
                http://www.ninjatrader.com/support/h...barsperiod.htm
                Cal H.NinjaTrader Customer Service

                Comment


                  #9
                  I use it in this way because so strategy use the drop down menu where I choose the frame type to be recalled (Is a strategy with multipleframe

                  Comment


                    #10
                    Turbofib,

                    You would want to declare the Enum outside the Namespace of the NinjaTrader.Indicator.

                    Additionally,here is a reference sample on doing this -
                    http://www.ninjatrader.com/support/f...ead.php?t=3420
                    Cal H.NinjaTrader Customer Service

                    Comment


                      #11
                      i had already done as in example but they also gave me problems in the export...

                      However, try again to get it

                      Comment


                        #12
                        Ok..it run and now i can export it....but i ask you last question
                        In your example (http://www.ninjatrader.com/support/f...ead.php?t=3420) the indicator includes enum ..
                        Is possible to have it on a separate file in order to call with all indicators and strategy that I want?
                        (My previous file "Lucaperiodtype.cs"" was inside the namespace and then not working properly .. but I do not know how to do it without using the namespace)

                        Comment


                          #13
                          Turbofib,

                          You can use the same script that you were using before you just need to call the Enum outside of the namespace and save it.
                          Once you start typing the name of it in the strategy it should populate.
                          Cal H.NinjaTrader Customer Service

                          Comment


                            #14
                            #region Using declarations
                            using System;
                            using System.ComponentModel;
                            using System.Diagnostics;
                            using System.Drawing;
                            using System.Drawing.Drawing2D;
                            using System.Xml.Serialization;
                            using NinjaTrader.Cbi;
                            using NinjaTrader.Data;
                            using NinjaTrader.Gui.Chart;
                            #endregion

                            namespace NinjaTrader.Indicator
                            {
                            public enum LucaPeriodType //added to isolate enum (copiato da un indicatore)
                            {
                            Day,
                            Minute,
                            Range,
                            Second,
                            Tick,
                            Volume,
                            }
                            }

                            i fill...is all Ok..

                            but..when i export strategy (where there is the call "enum") i find the same mistake

                            Comment


                              #15
                              Turbofib,

                              You need to declare the enum outside the Namespace NinjaTrader.Indicator
                              Cal H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by The_Sec, Today, 02:29 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post The_Sec
                              by The_Sec
                               
                              Started by tsantospinto, 04-12-2024, 07:04 PM
                              4 responses
                              62 views
                              0 likes
                              Last Post aligator  
                              Started by michi08, 10-05-2018, 09:31 AM
                              3 responses
                              741 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by sightcareclickhere, Today, 01:55 PM
                              0 responses
                              1 view
                              0 likes
                              Last Post sightcareclickhere  
                              Started by Mindset, 05-06-2023, 09:03 PM
                              9 responses
                              259 views
                              0 likes
                              Last Post ender_wiggum  
                              Working...
                              X