Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Basic Order Handling

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

    Basic Order Handling

    Ninjas,

    I'm fairly new to NT, so please be gentle I have a question about order handling.

    I trade an EOD strategy that enters a market as soon as the price exceeds a certain point. I've modelled this in my NT strategy with this line of code ("LongEntry()" calculates the breakout price) :

    EnterLongStopLimit(DefaultQuantity, LongEntry(2.0, 15).Entry[0], LongEntry(2.0, 15).Entry[0], "LongEntry");

    A trailing stop is then attached ("LongStop()" is my stop price) :

    ExitLongStop(DefaultQuantity, LongStop(2.0, 5).Stop[0], "LongStop", "LongEntry");

    Backtesting the strategy with these two lines of code works fine. However, as soon as I try to integrate the same sort of function calls to add short trades to the strategy things start to go downhill. The code looks like this:

    // Set entry orders
    EnterLongStopLimit(..., "LongEntry");
    EnterShortStopLimit(..., "Short Entry");

    // Set stop orders
    ExitLongStop(..., "LongStop", "LongEntry");
    ExitShortStop(..., "ShortStop", "ShortEntry");


    The results show that NJ reverses the position when a new entry is generated -- i.e. the stops are no longer taken into account.

    What am I not seeing?

    Tradey

    #2
    Hi Tradey,

    It's likely that you are running in to some of the built-in handing rules described at the bottom of the page here: http://www.ninjatrader-support.com/H...tml?Overview36

    Use TraceOrders to see what's happening with your orders: http://www.ninjatrader.com/support/f...ead.php?t=3627
    TimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    34 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, Yesterday, 02:41 AM
    0 responses
    15 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    25 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Working...
    X