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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      649 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      573 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      576 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X