Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

StopOrder not entered

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

    StopOrder not entered

    I wrote a strategy using the sampleonorderupdate as a starting point. So, in the OnExecution method, I have

    if (execution.MarketPosition == MarketPosition.Long)
    {
    stopOrder = ExitLongStop(stopPriceLong[0]);
    DrawArrowUp(
    "stop"+CurrentBar,0,stopPriceLong[0],Color.Red);
    }

    The ExitLongStop order isn't being placed nor is there an error in the log. However, the up arrow is showing on the chart. So, I'm wondering if you can give me any clues why this is happening.

    Thanks,
    Mike

    #2
    Hello Mike,

    With your draw statement executing, it looks like it's should submit the order. You might want to make an additional check here, that the order object is null prior to submitting.

    if (execution.MarketPosition == MarketPosition.Long && stopOrder == null)

    You'll also want to use TraceOrders output to track what may be happening here.
    Last edited by NinjaTrader_RyanM1; 10-01-2010, 11:11 AM.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks...traceorders helped. was able to get it fixed.

      thanks again

      Comment


        #4
        Great to hear. Thanks for the update.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          I spoke too soon. Longs are working fine...shorts are the problem.

          traceorders shows...
          9/30/2010 9:01:07 AM Ignored PlaceOrder() method at 9/30/2010 9:01:07 AM: Action=BuyToCover OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=10842 SignalName='StopShort' FromEntrySignal='Short' Reason='SignalName does not have a matching FromEntrySignal to exit'

          Sounds easy enough. Must've used a different name for the entry signal or at least that's what it sounds like. However, this is my code and I don't see a misspelled name.

          entryOrder = EnterShort(1,"Short)"); // this is obviously the entry order which is working.

          inside OnExecution
          stopOrder = ExitShortStop(0, true, execution.Order.Filled, stopPriceShort[0], "StopShort", "Short");

          The FromEntrySignal "Short" looks to be the same for entry and stop. Am I misunderstanding what the error is saying?

          Mike

          Comment


            #6
            Hi Mike,

            Looks like a typo here - there is a discrepency between your signals names.

            "Short)" is not the same as "Short"

            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Holy cow! What a dummy. Thank you for proofreading my code.

              I guess I just looked at it for too long and got used to seeing the mistake.

              Mike

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              647 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X