Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exits using Limit orders

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

    Exits using Limit orders

    I am trying to create limit exit orders but they do not show up in a back test when price moves beyond my limit prices. Here's the simple exit code:

    if (Position.MarketPosition == MarketPosition.Long)
    {
    ExitLongLimit(LXprice, "LX");
    }
    if (Position.MarketPosition == MarketPosition.Short)
    {
    ExitShortLimit(SXprice, "SX");
    }

    If the order isn't filled, I'm happy to have the order canceled at the end of each bar and will calculate a new exit point for both long and short entries.

    Once I get over this hurdle, I'd like to tie these exits to specific entries but the examples are limited on the ExitLongLimit help page. Could you please give me an example of how this is done? ie: Exit a long position, naming the exit so it shows up on the chart and also tying that exit to a specific entry.

    Also... I'd rather not use SetProfitTarget. When I tried this, only the Long Limit entries worked. Short Limit entries did not show up in a back test.

    #2
    Hello,

    Using Print(), I would first check the condition values before the if conditions and use Print("is in conditon 1") etc. to see if it is even entering the condition.

    If all is well with the above, use Print() again to see if the price you are using is reasonable and signal names match your entry signal names.

    Thiis link may help:
    DenNinjaTrader Customer Service

    Comment


      #3
      Using print and checking the output window, I have confirmed that these exit statements are being hit. I also printed out the prices of the limit orders and checked these prices with the date/timestamps on the chart. Price moves through these points but no exit occurs. In the Exit Limit statements I have tried the following to no avail:
      1) putting in the price AND entry name
      2) only putting in the exit price (as listed below).

      if (Position.MarketPosition == MarketPosition.Long)
      {
      ExitLongLimit(LXprice);
      Print(Time[0].ToString() + " LXprice=" + LXprice + " Bar#=" + CurrentBar);
      }

      Comment


        #4
        Hello,

        I'm not sure, sorry. Maybe post your log and trace files. Also, you do know what if you are long, and you submit a short order (for example), it will bring you flat. In other words, you don't need to submit an exit.

        Also, you do know that you have to submit a working order each bar right?

        Did you cofirm that the order is still working and exists at the time price moves through the order price?
        DenNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by alifarahani, Today, 09:40 AM
        6 responses
        31 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        17 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        13 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Waxavi, Today, 02:00 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X