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

Order has been ignored during optimization

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

    Order has been ignored during optimization

    So i was optimizing my strategy on usdjpy on 1 min time frame and it keeps giving me this error eventually leading to a crash, the bars required to trade is 20. for reference during backtesting in the same time periods there is no such error and this error only happens when i try optimizing more than one year. i also don't have any custom add ons so i don't whats causing the problem.
    Last edited by Mo98alda; 08-19-2021, 01:24 PM.

    #2
    Hello Mo98alda,

    Thanks for your post and welcome to the NinjaTrader forums!

    As this post is more about strategy development I will move this topic to NT8 strategy development forum.

    A strategy parameter is the Bars required to trade which by default is set to the first 20 bars. The reason this is set is that most indicators will not display within the first 20 bars, by default, on the chart so if your strategy uses/displays indicators, then an order placed within the first 20 bars may appear to be not based on anything. Indicator values, while not plotted in the first 20 bars are still being calculated and can be used in conditions that place an order and that is what has happened. As the message states, the order was simple ignored and not placed.

    Your options are:

    1) Ignore the error message as your strategy will continue trading after the 20th bar (but still generating needless error messages).

    2) Change the BarsRequiredToTrade value to something less than 20. The parameter is available when you apply the strategy or can be set by you in State.SetDefault. (If using the strategy builder, it can be found on the "Default Properties" page under "More properties" as "Minimum bars required". For Ninjascript, please see: https://ninjatrader.com/support/help...redtotrade.htm

    3) Change your strategy coding so that you do not place a trade in the first 20 bars, this would be the best option. In Ninjascript you could do something like:
    if (CurrentBar < BarsRequiredToTrade) return; // do not process below this line until 20 bars
    Or if using the Strategy Builder, in each entry set add the condition Misc>Current bar, Greater, Misc>numeric value> 20

    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_PaulH View Post
      Hello Mo98alda,

      Thanks for your post and welcome to the NinjaTrader forums!

      As this post is more about strategy development I will move this topic to NT8 strategy development forum.

      A strategy parameter is the Bars required to trade which by default is set to the first 20 bars. The reason this is set is that most indicators will not display within the first 20 bars, by default, on the chart so if your strategy uses/displays indicators, then an order placed within the first 20 bars may appear to be not based on anything. Indicator values, while not plotted in the first 20 bars are still being calculated and can be used in conditions that place an order and that is what has happened. As the message states, the order was simple ignored and not placed.

      Your options are:

      1) Ignore the error message as your strategy will continue trading after the 20th bar (but still generating needless error messages).

      2) Change the BarsRequiredToTrade value to something less than 20. The parameter is available when you apply the strategy or can be set by you in State.SetDefault. (If using the strategy builder, it can be found on the "Default Properties" page under "More properties" as "Minimum bars required". For Ninjascript, please see: https://ninjatrader.com/support/help...redtotrade.htm

      3) Change your strategy coding so that you do not place a trade in the first 20 bars, this would be the best option. In Ninjascript you could do something like:
      if (CurrentBar < BarsRequiredToTrade) return; // do not process below this line until 20 bars
      Or if using the Strategy Builder, in each entry set add the condition Misc>Current bar, Greater, Misc>numeric value> 20
      yeah but the problem isn't with the strategy as my strategy works fine during backtesting but not when i'm optimizing and this problem always crashes nt8

      Comment


        #4
        Hello Mo98alda,

        Thanks for your reply.

        Please attach a reduced code version of your strategy that will reproduce the condition of no error message when backtesting and many error messages when optimizing.

        A reduced code version is only the code needed to reproduce the error, for example if (Close[0] > Open[0]) { EnterLong());

        Alternatively, try changing your code so that error message is not possible.


        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Rapine Heihei, Today, 08:19 PM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 08:25 PM
        0 responses
        6 views
        0 likes
        Last Post Rapine Heihei  
        Started by f.saeidi, Today, 08:01 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by Rapine Heihei, Today, 07:51 PM
        0 responses
        8 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        98 views
        1 like
        Last Post caryc123  
        Working...
        X