MOC orders not working

zy102953zy102953 Posts: 4
edited July 2017 in Support

Hi everyone,

I run a single day backtest and exit all my open positions using MOC orders at the end of the day. But after the backtest is done, I have a lot of open positions. Anyone has the same problem?

Comments

  • zy102953zy102953 Posts: 4

    *** Update.***
    I looked into those open positions. Most of them have nan in md.L1.closing_trade. Myabe that is because those symbols do not have closing print

  • shayneshayne Posts: 70

    @zy102953 said:
    *** Update.***
    I looked into those open positions. Most of them have nan in md.L1.closing_trade. Myabe that is because those symbols do not have closing print

    That's correct - no closing print on the exchange of the MOC then no fill. md.L1.closing_trade will be NaN until there's a print. Reminder, large NYSE/AMEX closing prints can be delayed up to half hour after the close, but a majority fill close to the time of the closing bell. Also, you might want to run your back until 17:00 to catch all late prints if doing NYSE/AMEX on close orders

  • jm801551jm801551 Posts: 1

    New to CQ... I put in the following round turn:
    order_id = order.algo_buy(self.symbol, "market", intent="init", order_quantity=qty)
    order_id = order.algo_sell(self.symbol, "28bfb89c-93f9-45b1-b414-f79aa16865c5", intent='exit') # in on_fill... I guess I'm not to supply qty?

    Console shows both orders being generated:
    SITO 2017-06-05 10:01:05.005000 order number: 0000000000000001
    SITO 2017-06-05 10:01:05.006700 order number: 0000000000000002

    Tried tweaking the end time of the sim but I'm still not getting any MOC fill. Also, saw this in the docs:

    2016-09-15
    ARCA order logic changes MOO,MOC,LOO,LOC orders will now fill on the symbols primary exchanges( NASDAQ, NYSE), if that symbol doesn't have an open print on ARCA.
    

    My goal is to have some existing algo manage the details of MOC... just get me out! For any symbol. Tips?

  • shayneshayne Posts: 70

    jm801551 -

    Without seeing some sample code, my guess is that those orders are being placed back-to-back. If so, the "exit" is being rejected because you aren't in the trade (and there is nothing to exit) when the order is being placed. Does that make sense?

    -Shayne

Sign In or Register to comment.