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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      81 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      66 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X