Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Using some order commands at one OnBarUpdate

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

    Using some order commands at one OnBarUpdate

    Hello,

    here is the situation.
    I have opened positon. Then at one moment in OnBarUpdate i decide to change the position to opposite. I close my position with ExitLong or ExitShort and immediately send EnterShortLimit or EnterLongLimit, and then receive usual "An Enter() method to submit an entry order at '11/05/2017 03:48:54' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation."

    The log:

    Code:
    Historical 11/05/2017 03:48:54      We're are in long position right now. Exiting it...
    Historical 11/05/2017 03:48:54    Order updated: Type=Market; Action=Sell; Name=Exit long; Qty=1; CurrentState=Submitted; 
    Historical 11/05/2017 03:48:54    Order updated: Type=Market; Action=Sell; Name=Exit long; Qty=1; CurrentState=Accepted; 
    Historical 11/05/2017 03:48:54    Order updated: Type=Market; Action=Sell; Name=Exit long; Qty=1; CurrentState=Working; 
    Historical 11/05/2017 03:48:54    Attention: Entry signal occured: Enter short: 
    Historical 11/05/2017 03:48:54      Opening short limit at price 47.4...
    Strategy 'Adam Trading Strategy/-1': An Enter() method to submit an entry order at '11/05/2017 03:48:54' has been ignored. Please search on the term 'Internal Order Handling Rules' in the Help Guide for detailed explanation.
    Historical 11/05/2017 03:48:54    Order updated: Type=Market; Action=Sell; Name=Exit long; Qty=1; CurrentState=Filled; FillPrice=47.45; 
    Historical 11/05/2017 03:48:54    Filling executed. Current price info:Current Ask=47.45, Bid=47.45, Bar Index=22, Bar TOHLC=[11/05/2017 03:48:54;47.45;47.47;47.44;47.45], Bar Ticks=1, Position=[Flat]
    Historical 11/05/2017 03:48:54    Position updated: instrument='CL 06-17' account='Backtest' avgPrice=0 quantity=0 marketPosition=Flat statementDate='1800-01-01'
    I see the reason: my order for exiting the position is not filled yet when I try to enter ShortLimit. If I postpone my short limit order and send it AFTER exit position execution, everything will be ok. But I can't, because I have the signal exactly on this bar and I must to place order right now (in current OnBarUpdate instance)

    Is there any mechanism to wait exiting position filled not leaving OnBarUpdate?

    #2
    Hello,

    Thank you for the post.

    In this situation, one solution could be instead of using Exit orders, submit EnterShortLimit to reverse the position. Calling the opposite Entry order method would both Close and Enter into the opposite direction. If you are worried that the position may not close you would also need to review the isLiveUntilCancelled true in case the order is being expired when a bar closes. Otherwise, what you are seeing would be expected and you would need to wait for the exit to fill before submitting the new limit.

    If you are using OnBarUpdate to wait for the next bar to check for the exit to be filled, using OnExecutionUpdate may provide quicker confirmation on the fill so a new entry can be submitted upon filling:


    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, 03-13-2026, 05:17 AM
    0 responses
    86 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    151 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    79 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    53 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    60 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X