Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLongLimit not being updated

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

    ExitLongLimit not being updated

    I would like to find an explanation for this strange behaviour of Exit Limit orders.

    I use to launch Exit Limit orders as a profit target with LiveUntil Cancelled set to true:

    ProfitOrder = ExitLongLimit(0,true,Position.Quantity,ProfitPrice ,"","");

    This is thi only active order. So, there are not other orders competing with this one. I allways manage to have only one active limit order.

    The strange thing is that those orders sometimes dissapear from the Orders tab. When I print the order state of ProfitOrder it appears as filled (while the position is still open) , Cancelled or simply equals to null.

    In this case what I do is to recover again the order. To do this I check that the market position is Long or Short and if ProfitOrder is null I set it again:

    ProfitOrder = ExitLongLimit(0,true,Position.Quantity,ProfitPrice ,"","");

    When doing this two thing happen: the order is not set again or I receive a message like this

    "**NT** You can't change the order quantity below the amount of already filled units. Affected order: Order='03c9bc614a1c44f39851526af9b8e76f/Sim101' Name='Buy to cover' State=PartFilled Instrument='$AUDUSD' Action=BuyToCover Limit price=1.0155 Stop price=0 Quantity=130,400 Strategy='FOREX2' Type=Limit Tif=Gtc Oco='' Filled=104453 Fill price=1.0155 Token='03c9bc614a1c44f39851526af9b8e76f' Gtd='12/1/2099 12:00:00 AM'"

    This later error message appears even when the Position.Quantity = 25947

    Perhaps there is any previous step to take before setting up again the order?

    thanks

    #2
    guillembm,

    I am happy to assist you.

    Unfortunately without some test case, such as your strategy, I am unable to really comment further.

    Please ensure your strategy isn't causing cases like below :

    Methods that generate orders to enter a position will be ignored if:
    • A position is open and an order submitted by an exit method (ExitLongLimit() for example) is active and the order is used to open a position in the opposite direction
    • A position is open and an order submitted by a set method (SetStopLoss() for example) is active and the order is used to open a position in the opposite direction
    • The strategy position is flat and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
    • The entry signal name is not unique

    Methods that generate orders to exit a position will be ignored if:
    • A position is open and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
    • A position is open and an order submitted by a set method (SetStopLoss() for example) is active

    Set() methods that generate orders to exit a position will be ignored if:
    • A position is open and an order submitted by an enter method (EnterLongLimit() for example) is active and the order is used to open a position in the opposite direction
    • A position is open and an order submitted by an exit method (ExitLongLimit() for example) is active

    If you would post a strategy exhibiting the behavior and give me the setup details you are using to test it with (i.e. which data provider, which instrument, which timeframe, etc.). I would be happy to test it out for you.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by davian05, 12-31-2024, 05:05 AM
    10 responses
    237 views
    1 like
    Last Post workfornowork  
    Started by timmbbo, 06-06-2022, 09:12 PM
    4 responses
    280 views
    0 likes
    Last Post Fertryd2  
    Started by llanqui, 03-05-2025, 06:03 AM
    16 responses
    101 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by Daniel Roa, Today, 09:56 AM
    2 responses
    17 views
    0 likes
    Last Post Daniel Roa  
    Started by Playdc, Today, 03:33 PM
    1 response
    9 views
    0 likes
    Last Post bltdavid  
    Working...
    X