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 cmv727, Today, 10:38 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Adrian1028, Today, 10:52 AM
    1 response
    2 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by trilliantrader, 04-10-2024, 09:33 PM
    4 responses
    18 views
    0 likes
    Last Post trilliantrader  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    158 responses
    2,138 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by michi08, Today, 08:53 AM
    5 responses
    17 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Working...
    X