Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with Stop Orders

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

    #16
    To be honest Brett if you could simply tell me what is wrong with the following code then that would be much quicker:

    Code:
    			if (CrossAbove(MAseries, DWMAseries, 1))
    				{if (myEntryOrderL == null)
    				myEntryOrderL = EnterLongStop(0, true, 1, High[0] + TickSize, "L");
    				else if (myEntryOrderS != null)
    				CancelOrder(myEntryOrderS);}
    			else if (CrossBelow(MAseries, DWMAseries, 1))
    				{if (myEntryOrderS == null)
    				myEntryOrderS = EnterShortStop(0, true, 1, Low[0] - TickSize, "S");
    				else if (myEntryOrderL != null)
    				CancelOrder(myEntryOrderL);}
    				#endregion
    Put simply if MA's cross then it enters a stop order at 1 tick above/below high/low of signal bar, then the order needs to stay on the market until it crosses the other way. Let me know if there is any confusion.

    Comment


      #17
      Hello,

      I took a look however I dont see anything specifically off with these lines of code. However they would require adding in the Print statements and Trace orders to isolate what actions the strategy is taking at one times to help us narrow down what is going on.


      I dont see you specifically setting the iOrder object to null, are you doing this inside of OnOrderUpdate()?

      -Brett
      BrettNinjaTrader Product Management

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      68 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      61 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X