Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Help with order management

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

    Help with order management

    I have a strategy that functions as I want it to for the backtest, with two entries per direction. The strategy goes to hell on the forward testing. It will have three entries at times miss exit signals altogether and not exit until close. I suspect it could be that my stoploss and pricetarget orders conflict with my exit signal (a cross over) if they execute on the same bar. What I find very bizzare is that I have trades with entry names "Close position" and "Sell" when the only entry signal names in my code are "1,2,3 and 4". Any ideas of why this would happen or what I should do to correct this?

    thanks

    #2
    I set a profit target and a stop loss per direction, seeing as these are OCO, one and sometimes both cancel when the entry is submitted. I though OCO meant that if a profit target was met that the stop loss would be canceled and vice versa, apparently I was wrong, it seems to mean that if two of these are simultaneously set one of them is immediately canceled. If I now understand this correctly I can program my own profit target and keep the stop loss, it will be a little bit of an irk but I think I can deal with that.

    If a position is exited by a crossover signal, will existing price targets or stop losses be canceled?

    That should help thinks go a bit more smoothly but it still does not explain why my crossover exit signals can be ignored completely for the remainder of the trading session.

    Comment


      #3
      Hi Chris, let's clarify a few points so you can more effectively troubleshoot your setup hopefully -

      The Enter() method will reverse for you, so if you have a reversal signal, there's no need for calling an extra ExitLong for example first and then EnterShort, this would actually lead easily to duplicate trades / orders.

      When the managed position is closed, NT will cancel the associated exits for it, yes - if you call any Exit statement but would not have a position open > NT will ignore that signal in it's managed mode operations.

      Generally when debugging the TraceOrders feature is very helpful, as it would give more detailed infos whats happening under the hood with your orders in NT's output window - https://www.ninjatrader.com/support/...raceorders.htm

      For the realtime matching of strategy vs account position I would also recommend paying close attention to the sync options of the script as you startup - https://www.ninjatrader.com/support/..._positions.htm

      The signal name Close position will always occur if NT reverses a position for you, that's the part of the enter method that gets your original position flat before actually submitting the order to get you into the new desired direction, so I would expect to see that even if you did not name a signal of your own like that. If you scale out of a position though, it would be paramount to scale in as well -

      BertrandNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by StockTrader88, 03-06-2021, 08:58 AM
      45 responses
      3,992 views
      3 likes
      Last Post johntraderuser2  
      Started by TAJTrades, Today, 09:46 AM
      0 responses
      7 views
      0 likes
      Last Post TAJTrades  
      Started by rhyminkevin, Yesterday, 04:58 PM
      5 responses
      62 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Started by realblubb, Today, 09:28 AM
      0 responses
      8 views
      0 likes
      Last Post realblubb  
      Started by AaronKoRn, Yesterday, 09:49 PM
      1 response
      19 views
      0 likes
      Last Post Rikazkhan007  
      Working...
      X