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

Am I going crazy? Ticks with Simulator

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

    Am I going crazy? Ticks with Simulator

    I must be going crazy. I was testing out a strategy in Simulator Data feed. The strategy was running on 1 tick. CalculateOnBarClose was false.

    Everything was fine up until a point. And I've retraced my steps and cannot figure out what happened. I now seem to be in a state where I cannot run a strategy (while in Simulator) in ticks. I've rebooted my machine, I've gone over my strategy 50 million times and I'm certain it is in a workable state.

    I started a new fresh strategy just to see if I can do the simplest things, and I cannot. Shouldn't this strategy do something if running on tick's in the Simulated data feed?

    Code:
    #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.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;
    #endregion
    
    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
        /// <summary>
        /// Enter the description of your strategy here
        /// </summary>
        [Description("Enter the description of your strategy here")]
        public class testingTicks : Strategy
        {
            #region Variables
            // Wizard generated variables
            private int myInput0 = 1; // Default setting for MyInput0
            // User defined variables (add any user defined variables below)
            #endregion
    
            int counter = 0;
            /// <summary>
            /// This method is used to configure the strategy and is called once before any strategy method is called.
            /// </summary>
            protected override void Initialize()
            {
                CalculateOnBarClose = false;
            }
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
                Print("Count: " + counter.ToString()); counter++;
                
            }
    
            #region Properties
            [Description("")]
            [GridCategory("Parameters")]
            public int MyInput0
            {
                get { return myInput0; }
                set { myInput0 = Math.Max(1, value); }
            }
            #endregion
        }
    }

    #2
    Hello,

    When I test this code on my end on a tick chart with the simulated data feed, it is functioning as expected and printing the count. Are you certain that the strategy is currently enabled?
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Yes. I'm positive. Something has clearly gone whacky in my setup, and I cannot figure out what happened. Any ideas for me to try?

      Comment


        #4
        Originally posted by lookOutBelow View Post
        Yes. I'm positive. Something has clearly gone whacky in my setup, and I cannot figure out what happened. Any ideas for me to try?
        Your output window shows nothing!?!!!???

        Did you add the strategy to a chart or the strategy tab?
        (It shouldn't matter...)


        Can you try other charts, like minute charts?

        Comment


          #5
          The strategy was added to the strategies tab. Same result in a chart.. Minutes work fine as long as I load more than 3 days (which is odd in of itself). No warnings or errors. It simply doesn't work.

          This is the only thing the output window says

          **NT** Enabling NinjaScript strategy 'testingTicks/00893d044426438285962dea66210022' : On starting a real-time strategy - StrategySync=WaitUntilFlat SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=PerEntryExecution ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=True/ triggering 30 before close Set order quantity by=Strategy ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDisable=True CalculateOnBarClose=False MaxRestarts=4 in 5 minutes
          Everything was working fine one minute, then it just lost it. The last thing I remember adding/playing around with before everything started going haywire, was this line.

          Code:
          double commissions = Performance.AllTrades.TradesPerformance.Commission;
          Not that that has anything to do with it. But for the record, that is what I was playing around with.

          Comment


            #6
            Not sure if this helps. ...

            If I run that same simple strategy on 1min chart with 3 days of data (simulator). It prints out till "Count: 778" and just stops. Never updates beyond that. Doesn't matter if CalculateOnBarClose is true or false.

            This problem does not exist with Market Replay.

            Comment


              #7
              And lastly. With simulated data, I'm getting quotes moving in the price ladders. But chart prices are not moving at all.

              * Ive reset/repaired database
              * I've reset instruments
              * I've changed workspaces
              * Market Replay seems to be working.

              Comment


                #8
                What is your session template set to?

                Comment


                  #9
                  Originally posted by sledge View Post
                  What is your session template set to?
                  I've tried a number of combinations. Doesn't make a difference. It is important to note that everything was working fine one minute, and literally a few minutes later it stopped. And between those times, I didn't change any of the settings of the program or the strategy. The only thing I was messing with is to include commissions in my PNL calculations. I've since deleted all strategies and indicators that I've written (backed up of course). Still not working.

                  I may have to uninstall and re-install unless someone has a cure..

                  Comment


                    #10
                    Now working again. I uninstalled and reinstalled the software. Still have no idea what caused the issues. But at least I can keep working. If it happens again, I'll be back with hopefully more details with what led up to the issue..

                    Thanks everyone.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by FishTrade, Today, 03:42 PM
                    0 responses
                    1 view
                    0 likes
                    Last Post FishTrade  
                    Started by Richozzy38, Today, 01:06 PM
                    3 responses
                    14 views
                    0 likes
                    Last Post Richozzy38  
                    Started by ttrader23, Today, 09:04 AM
                    2 responses
                    12 views
                    0 likes
                    Last Post ttrader23  
                    Started by geotrades1, Today, 07:54 AM
                    10 responses
                    26 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by ninza33, Yesterday, 12:31 PM
                    3 responses
                    16 views
                    0 likes
                    Last Post NinjaTrader_LuisH  
                    Working...
                    X