Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLong does not cancel trailstop order, leaving net short position instead of flat

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

    ExitLong does not cancel trailstop order, leaving net short position instead of flat

    Problem:

    Using ExitLong() as second stop loss, but trailing stop also executes, turning what should be a long exit into a net short position.


    Here is what I'm doing:

    Strategy is calculated on bar close not each tick.

    I'm using 2 data series.

    [0] the primary chart series is my signal series
    [1] the secondary series is the one I'm placing trades on

    Thus: in the State>Configure section I am adding only 1 data series.

    Note: the primary chart data series is not the same instrument as the data series I add and place trades on.

    The issue occurs in market replay (have not tested to see if this occurs in live market)

    1. I enter the position (inside of OnBarUpdate) by doing the following:

    a. set trailstop

    SetTrailStop(TradeType, CalculationMode.Ticks, TrailerSize, true);
    where TradeType is a striing I set and TrailerSize is a user entered integer

    b. establish a long position using a market order

    EnterLong(1,Convert.ToInt32(DefaultOrderQuantity), TradeType);


    2. On the primary data series (the chart)
    I test to see if price as exceeded a threshhold.
    If so, I submit an exitlong order on the secondary data series like this

    ExitLong(1,0, "","");

    The order and trailstop are established correctly, but the trailstop does not cancel after the position is exited.


    Is there something else I need to do to make sure the trailstop is removed?

    Thanks.







    #2
    Hello halgo_boulder,

    Please try using a signal name from the entry in the ext method instead of using a blank string to see if that helps. You used TradeType as the entries signal name, you can pass that to the exit as well to ensure it targets that specific entry and its position.

    JesseNinjaTrader Customer Service

    Comment


      #3
      OK I will give that a try thank you.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Jonker, Today, 01:19 PM
      0 responses
      1 view
      0 likes
      Last Post Jonker
      by Jonker
       
      Started by futtrader, Today, 01:16 PM
      0 responses
      4 views
      0 likes
      Last Post futtrader  
      Started by Segwin, 05-07-2018, 02:15 PM
      14 responses
      1,789 views
      0 likes
      Last Post aligator  
      Started by Jimmyk, 01-26-2018, 05:19 AM
      6 responses
      838 views
      0 likes
      Last Post emuns
      by emuns
       
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,294 views
      1 like
      Last Post jgualdronc  
      Working...
      X