Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

why is this not printing to the output window

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

    why is this not printing to the output window

    Code:
    
    namespace NinjaTrader.Strategy
    {
    ///<summary>
    /// Enter the description of your strategy here
    ///</summary>
    [Description("Enter the description of your strategy here")]
    publicclass MyCustomStrategy3 : Strategy
    {
    #region Variables
    // Wizard generated variables
    privateint myInput0 = 1; // Default setting for MyInput0
    // User defined variables (add any user defined variables below)
    #endregion
    privateint barAtPlaceStrategy ;
    ///<summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    ///</summary>
    protectedoverridevoid Initialize()
    {
    CalculateOnBarClose = true;
    barAtPlaceStrategy=CurrentBar;
    Print(" Current Bar when strategy opened " + barAtPlaceStrategy);
    }
    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    {
    Print("bar ticking");
    }
    #region Properties
    [Description("")]
    [Category("Parameters")]
    publicint MyInput0
    {
    get { return myInput0; }
    set { myInput0 = Math.Max(1, value); }
    }
    #endregion
    }
    }
    
    all i have done is declared a private variable and am trying to print to the output window. not sure why it is not doing it when i apply the strategy.

    #2
    Can you check your log tab of the Control Center window to see if there are any errors logged when running your strategy?
    RayNinjaTrader Customer Service

    Comment


      #3
      24/11/2008 4:32:04 AM Strategy Failed to call method 'Initialize' for strategy 'forexTrailingStop': 'CurrentBar' property can not be accessed from within 'Initialize' method

      what properties can/cannot be called from Initialize

      Comment


        #4
        E.g. the CurrentBar property is not supported in Initialize. Unfortunately there is no list of properties/methods not supported in Initialize.
        DierkNinjaTrader Customer Service

        Comment


          #5
          what factors determine if a property will be or will not be supported in the Initialize.

          Comment


            #6
            Unfortunately there are no such factors exposed/documented.
            DierkNinjaTrader Customer Service

            Comment


              #7
              this is rather pityful. its like buying a car from GM, the check engine light comes on and GM states, well we dont documetn why the check engine lights up. you have to find out trial and error.

              Comment


                #8
                junkone,

                Generally no logic goes into the Initialize() method. If you are trying to access anything to run logic it should be done in OnBarUpdate().

                This is a partial list of what is settable from the Initialize() of a NinjaScript Strategy: http://www.ninjatrader-support.com/v...06&postcount=5
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by junkone View Post
                  this is rather pityful. its like buying a car from GM, the check engine light comes on and GM states, well we dont documetn why the check engine lights up. you have to find out trial and error.
                  Hi junkone,

                  consider the following, hope that makes sense to you:

                  Initialize() is performed before your strategy starts running. Therefore it couldn't know anything about a bar number or even a bar number when using a multi-timeframe strategy.

                  Initialize() does all the things before you start your GM-car, like unlock the car, sit down, close the door and fasten the seatbelt.

                  Regards
                  Ralph

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by ballston, Today, 06:32 AM
                  0 responses
                  5 views
                  0 likes
                  Last Post ballston  
                  Started by Lando Calrissian, Today, 07:30 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post Lando Calrissian  
                  Started by facuevasm, Today, 07:28 AM
                  0 responses
                  1 view
                  0 likes
                  Last Post facuevasm  
                  Started by Leeroy_Jenkins, Today, 03:45 AM
                  0 responses
                  13 views
                  0 likes
                  Last Post Leeroy_Jenkins  
                  Started by sinpeople, Today, 04:38 AM
                  0 responses
                  10 views
                  0 likes
                  Last Post sinpeople  
                  Working...
                  X