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

(error) strategy

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

    (error) strategy

    Good morning sir
    I hope that you are well
    When I test the strategy I get this error message
    What is the cause of this problem
    And how can I solve it
    Please help
    Thanks

    Click image for larger version

Name:	error.png
Views:	144
Size:	54.7 KB
ID:	1229596

    #2
    That's a normal behaviour. Indeed, you can't place a "Sell-Stop" or a "Sell-Stop-Limit" order at a price level which is above the current market trading level.
    You won't allowed to do that, not in DOM, nor in Chart Trader, and of course any such Strategy-genetated order is rejected.
    Last edited by KonstantinosNT; 01-03-2023, 04:53 AM.

    Comment


      #3
      Hello jimmy12,

      Thanks for your post.

      KonstantinosNT is correct. You must ensure that your Sell Stop or Sell Stop Limit order is placed at a valid price. As stated in the error, Sell Stop and Sell Stop Limit orders must be placed below the current market price.

      Regarding the OCO ID error message, OCO ID's cannot be reused. This means a unique OCO ID should be used when submitting OCO-paired orders. You could view the forum thread linked below for more information about this error.



      Please let me know if I may assist further.
      Brandon H.NinjaTrader Customer Service

      Comment


        #4
        Hello sir
        Thank you for your help
        I found that the price moves rapidly before the order is placed, and that is why it is rejected and not executed
        Is there a way you would recommend for me to quickly place my orders before the market moves?​

        Comment


          #5
          Hello jimmy12,

          Thanks for your note.

          If this is due to market volatility then there isn't really a way to 100% avoid this occurring, as in volatile markets the market could move so far and fast that this would occur.

          Something you could do is change the strategy to use StopCancelCloseIgnoreErrors for its error handling; you could then capture the rejection in OnOrderUpdate, and then either try to resubmit the stop at a different price or submit an exit order to close the position.

          You can find more information about real-time error handling for strategies here, along with an example of capturing the rejection:
          https://ninjatrader.com/support/help...orhandling.htm

          Or, you could consider is using GetCurrentBid() and GetCurrentAsk() to offset orders so that they are more likely to land on the correct side of the market.

          See these help guide pages for more information.
          GetCurrentBid(): https://ninjatrader.com/support/help...currentbid.htm
          GetCurrentAsk(): https://ninjatrader.com/support/help...currentask.htm

          Let us know if we may assist further.​
          Brandon H.NinjaTrader Customer Service

          Comment


            #6
            Good morning sir
            thanks for helping me
            I will try to do what you said
            But I have a simple question, if I work on a super fast computer, is it possible to solve the problem?
            Or is it just a temporary solution?​

            Comment


              #7
              Hello jimmy12,

              Thanks for your note.

              The speed of a computer would likely not make a difference. There are no supported means for forcing a strategy to submit orders quicker.

              The most frequent interval that OnBarUpdate will process logic is when a Calculate mode of OnEachTick is used.

              Calculate: https://ninjatrader.com/support/help.../calculate.htm

              As stated in my previous post, "If this is due to market volatility then there isn't really a way to 100% avoid this occurring, as in volatile markets the market could move so far and fast that this would occur."

              You could take the approaches mentioned in post # 5 to work around this behavior.

              Please let me know if I may assist further.
              Brandon H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by andrewtrades, Today, 04:57 PM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by chbruno, Today, 04:10 PM
              0 responses
              6 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by josh18955, 03-25-2023, 11:16 AM
              6 responses
              436 views
              0 likes
              Last Post Delerium  
              Started by FAQtrader, Today, 03:35 PM
              0 responses
              9 views
              0 likes
              Last Post FAQtrader  
              Started by rocketman7, Today, 09:41 AM
              5 responses
              19 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X