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 PaulMohn, Today, 03:49 AM
    0 responses
    3 views
    0 likes
    Last Post PaulMohn  
    Started by inanazsocial, Today, 01:15 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by rocketman7, Today, 02:12 AM
    0 responses
    10 views
    0 likes
    Last Post rocketman7  
    Started by dustydbayer, Today, 01:59 AM
    0 responses
    2 views
    0 likes
    Last Post dustydbayer  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    5 responses
    23 views
    0 likes
    Last Post trilliantrader  
    Working...
    X