Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Stop gives price of zero

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

    Unmanaged Stop gives price of zero

    Using the following code whenever my "stoplong" order triggers it reports a fill at zero instead of at the stop price. Am I misusing the SubmitOrder for Unmanaged?
    Code:
    	IOrder buy = null, sell = null, stoplong = null, stopshort = null, targetlong = null, targetshort = null;
    
            protected override void OnBarUpdate()
            {
    	buy = SubmitOrder(0, OrderAction.Buy, OrderType.Limit, 100, sPrice, 0, "", "Buy");
    ...
    
    	protected override void OnExecution(IExecution execution)
    	{
    		if (buy != null && buy == execution.Order) {
    			stoplong = SubmitOrder(0, OrderAction.Sell, OrderType.Limit, 100, 0, sPrice - _lossLimit, "", "Sell Stop");
    			targetlong = SubmitOrder(0, OrderAction.Sell, OrderType.Limit, 100, sPrice + _profitTarget, 0, "", "Sell Target");
    		}
    ...

    #2
    Never mind: I see that I had the OrderType for my stop order still set to OrderType.Limit. Changing to OrderType.Stop fixes this!

    Comment


      #3
      Hi dbooksta, thanks for your post.

      That's great, I'm glad you were able to find the issue! Feel free to reply with any further questions you may have.
      <span class="name">Alex C.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment

      Latest Posts

      Collapse

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