I have an idea. How can I implement it?

Discussion in 'Automated Trading' started by ndisgiiet, Apr 2, 2021.

  1. terr:
    Thank you for the insight and offer to help. I might just take you up on it. To answer:
    1 - I hope so
    2 - I have TD which does have an API, but poking around on the web it seems it cannot be fully automated, but I could have read wrong or outdated info. Tradestation that I am considering also has API and it appears that it might be able to be setup fully automated. Again I could be wrong, but that why I came here to see what people knew.
    3 - Yes, currently my method would rely on the open price. I thought about using the pre-market price seconds/minute before open since it would be similar perhaps, but I not sure about the volume issues there or if its even possible.
    4 - I am wondering the same thing myself. There are no * anywhere in any terms in relation to something like that, but who knows. Same question for Tradestation or anyone else you might suggest.

    virtusa:
    I completely agree with your suggestion to manually test, but how? To test my idea precisely, I will need to place hundreds to most likely thousands of orders within seconds/minute of open. Just isn't possible manually. Must be automated, and then, can it even be done with a paper account? That is what I was hoping to find out.

    EVERYONE:
    Let me address one of the things that keep popping up. I understand how crazy the market is at open believe me. Here is my train of thought. If my theory buys at open and sells at close no matter what, and for now, lets assume I use market orders (havent fully decided this, but let's just assume), well then the following might happen. Lets assume I am buying 2000 stocks each morning with the expectation that they will rise by EOD:
    - Some will execute at higher than open decreasing/eliminating/hurting my expected profits and some will execute at lower than open, increasing my expected profits. Same rules for when it sells both ways. It is a crapshoot, but buying so many stocks, it MIGHT wash out in the end if it is a solid idea. Yes, I get the risk, but again, just an idea. No fees trading would help this method drastically, I would say almost mandatorily, but again, can it be done and by which platform/vendor?

    Thanks again everyone!
     
    #21     Apr 3, 2021
  2. I'll check it out. Thank you!

    Has anyone else in here used Alpaca?
     
    #22     Apr 3, 2021
  3. qlai

    qlai

    You don’t have to assume, you will have to use market orders because you will not be able to get market data for 2000 stocks at the open (at least not accurate enough for placing intelligent limit orders)
     
    #23     Apr 3, 2021
  4. Thank you for the thoughts. Here was my thinking on limit orders:

    For shits and giggles, lets assume all the stocks I pick will close higher than open based on my strategy (yeah I know lol). Assuming that, another option besides a market order is that I could also place a "limit" order, as soon as possible in the trading day, at whatever the open price was, and let the order ride until if/when it triggers. It really shouldn't matter when it executes since the strategy specifically relies on the open price itself compared to the closing price. And if it never hits the open price again throughout the day, well then the order would be cancelled when all the other buys are sold at EOD, and I will just have not traded that particular stock. Maybe that is going to hurt my strategy, maybe it will not. I wish I could paper test it. However, the same cannot be said for the close, as knowing the close price would be predicting the future :). So at EOD, I would be forced to just flatten all trades and hope for the best within seconds/minute of close.
     
    #24     Apr 3, 2021
  5. Also, when you say get market data for the 2000 stocks would take time, would that be any kind of data at all, or just more complex intraday type data which I dont need. I am only using EOD type data (open, high, low, close, volume). Is that still going to take a long time? How long would you estimate? Again, thank you for you insight.


    EDIT: The more I think about it, and as far as it needing time to calculate stuff at open, it really doesn't matter whether I place a market order or limit order as far as logistics goes, because either way, it will HAVE to know todays 'open' vs the data I choose from EOD data from previous days.
     
    Last edited: Apr 3, 2021
    #25     Apr 3, 2021
  6. qlai

    qlai

    Someone already mentioned that you need to place MOO (market on open) orders prior to market open. And then MOC (market on close). I ran something like that with IB where I simply loaded the orders from my spreadsheet into TWS - no coding required. Don’t over complicate things for no reason.
     
    #26     Apr 3, 2021
  7. But how can I do that if my purchasing decisions are literally based on the open price compared to some previous day(s) data. To do the orders pre-market would entail me predicting the open price, when in fact, i am needing/using the open price to make my purchase selections.

    Unless there is a way to place pre-market orders with rules, such as 'only execute this order if open price is XYZ' or something like that.
     
    #27     Apr 3, 2021
  8. qlai

    qlai

    Then you use LOO (limit on open) orders. So, buy if stock is down 10 percent or more. Place limit order 10 percent away from yesterday close
     
    #28     Apr 3, 2021
  9. Thank you for sticking in there with me. Let me walk this through in my head.

    Option 1: Wait for open, scan all stocks on market for any that meet my criteria (open price compared to XYZ), which could potentially be half the stocks on the mark, and then placing market or limit orders as fast as possible on those specific stocks only

    Option 2: At the end of each days trading session, do the math for every stock on the market to determine what they would need to open at the next day to be considered a buy, and then place LOO orders on every stock on the market, which could be 4-5k stocks or whatever it is, and see which ones execute at open and cancel the ones that do not execute.

    Do these sound correct? BTW, I thought I read that setting up automated trading is even harder during pre and post markets? Is that true?
     
    #29     Apr 3, 2021
  10. If pre-market automated scanning and trading will work on pre-market information, I guess another option could be to scan pre-market within moment of open and look at 'last' sale price, and use that to run my picks instead of 'open' price, assuming that the numbers would be close. And only place orders accordingly. However, I don't know how close those two numbers would be and it definitely alters my strategy and ability to test it, since I only have EOD data to test against. Nothing before hours or after hours in my data.
     
    #30     Apr 3, 2021