Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Perhaps my database if messed up?

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

    Perhaps my database if messed up?

    Hi there.
    Fresh install of Windows 10 then Ninjatrader 8.
    I was rolling along fine but then realized that Microsoft was storing all my data in One Drive, so I changed that. NT was acting all messed up so I reinstalled the product and it seems mostly okay (except for seemingly random disconnects of NT continuum and 'My Ninja Trader'). My Strategies don't seem to be placing any orders. There is nothing listed in 'Orders' or 'Positions' tab, but i keep getting these errors in the 'logs' tab:"
    4/24/2023 10:22:35 AM,Default,Strategy 'MeanReversion/-1': An order placed at '10/17/2022 03:40:00' has been ignored since the order was submitted before the strategy property BarsRequiredToTrade had been met.​" but also this one (SAYS 2019):"4/24/2023 9:00:00 AM,Default,Strategy 'LSBEMACD/-1': An order placed at '06/02/2019 21:40:00' has been ignored since the order was submitted before the strategy property BarsRequiredToTrade had been met.,".

    I don't know if maybe the database is corrupt, but obviously I didn't make any trades in 2019.

    I did try 'Reset Database' but it doesn't seem to have helped.

    Is there some way I can just get this cleaned up so that it functions again?

    Thanks,
    Cartoad

    #2
    Download the setup and run a repair installation now that you have OneDrive disabled?
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Hello Cartoad71,

      Welcome to the NinjaTrader forums!

      With the message:
      'An order placed at '10/17/2022 03:40:00' has been ignored since the order was submitted before the strategy property BarsRequiredToTrade had been met.'

      You can think of this as more of a warning than an error message.

      The message is letting you know the code in the strategy attempted to submit an order when CurrentBar was less than BarsRequiredToTrade.

      To prevent the error, do not place orders until CurrentBar is equal to or greater than BarsRequiredToTrade.

      Add to the top of OnBarUpdate():

      if (CurrentBar < BarsRequiredToTrade)
      return;

      Or set BarsRequiredToTrade to 1.





      Note, a yellow strategy name, means there is a historical virtual position open and the strategy is waiting for the virtual position to close.



      If the expected trade(s) are not appearing, this would indicate that the condition to place the order is not evaluating as true and the order is not being submitted, or the order is being ignored for other reasons, or the order is being cancelled.

      To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

      In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.
      The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

      Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

      Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

      I am happy to assist you with analyzing the output from the output window.

      Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

      Below is a link to a forum post that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.
      https://ninjatrader.com/support/foru...121#post791121

      Please let me know if I may further assist with analyzing the output or if you need any assistance creating a print or enabling TraceOrders.​
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hello Bruce,
        I have done this, and after setting up the Strategy again, the log says "'4/24/2023 3:24:45 PM,Default,Strategy 'LSBEMACD/293817196': An order placed at '04/18/2023 20:00:00' has been ignored since the order was submitted before the strategy property BarsRequiredToTrade had been met" There is no order in 'Orders' Tab showing and nothing in Positions. I am concerned that the Strategy won't be able to submit any orders.

        Thanks,
        K
        ​"

        Comment


          #5
          If this is your strategy that you have the source code to, in State.SetDefaults you can just set BarsRequiredToTrade = 0; and there will be no minimum number of bars anymore.
          Bruce DeVault
          QuantKey Trading Vendor Services
          NinjaTrader Ecosystem Vendor - QuantKey

          Comment


            #6
            Well perhaps it is working, thanks for your help. I have another issue but will open another 'ticket'; thanks!

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            21 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            120 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            63 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            41 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            45 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X