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

Weird situation with stop loss and profit target orders

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

    Weird situation with stop loss and profit target orders

    I have developed a strategy that submits stop loss and profit target orders after it verifies that the order is filled. I check : entryOrder.OrderState == OrderState.Filled.

    In all my replay testing and demo trading with IB I did not see any issues. All worked as it should.

    I did hit a weird situation this morning around 8:30 am. The strategy submitted stop limit at 8:31, and it was executed at 8:33:01 and immediately closed that same second at 8:33:01. The reason why it was closed is because that same second strategy (or something else) submitted stop loss and profit target several points below my filled order price, and as the result of profit target being below market, the broker closed the position immediately. Normally strategy puts stop loss few point below and take profit few points above entry order (for Longs).

    This definitely looks like a bug, and I would normally try to figure out what part of my code caused it. Here is the strange part.

    I have the following code in my strategy: TraceOrders = true; This code adds every order that strategy submits to Output window.

    The 2 weird (below filled order price) stop loss and profit target orders, that I mentioned above, are visible in control center Log tab, but they are not in Output window.

    So the questions if they are not in output window and my strategy did not submit them, where did they come from?

    This only happened once, in all other trades everything worked as it should.

    Thanks,
    redduke

    #2
    Thanks for the report RedDuke, would those orders somehow be tagged as 'External' in the logs? Would you mind sending us the logs / traces from today then to review the event sequence seen here?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      Please see attached files for the logs. The stop limit order was submitted for 1932.25, and the same second when it was filled, profit target for 1927.25 and stop loss for 1923.75 were submitted. You will see them in "ninja control center log" file, but they not there "ninja output window log" file.

      Thanks,
      redduke
      Attached Files

      Comment


        #4
        Can you please attach the direct trace and log file from NT? That would be found under the Documents > NinjaTrader7 > log / trace folders. Actually it would be best if you contacted us from within your NT Help > Mail to Support for this as the needed files will then be included in your request. Thanks.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Bertrand,

          I just e-mailed the logs to support with your name in the subject.

          Thanks,
          redduke

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Balage0922, Today, 07:38 AM
          0 responses
          1 view
          0 likes
          Last Post Balage0922  
          Started by JoMoon2024, Today, 06:56 AM
          0 responses
          6 views
          0 likes
          Last Post JoMoon2024  
          Started by Haiasi, 04-25-2024, 06:53 PM
          2 responses
          19 views
          0 likes
          Last Post Massinisa  
          Started by Creamers, Today, 05:32 AM
          0 responses
          6 views
          0 likes
          Last Post Creamers  
          Started by Segwin, 05-07-2018, 02:15 PM
          12 responses
          1,786 views
          0 likes
          Last Post Leafcutter  
          Working...
          X