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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      59 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      161 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      97 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      276 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X