I found an interesting bug that caused my algorithms to only trade from one IB scan that I had listed. I discovered it because it did not trade a perfect flag setup on $SYN a few days ago despite it being in most of the scans.
After fixing it on Friday I figured on Monday it would do one of the following:
- Still take the same amount of trades because the ideal perfect setup is not occurring that frequently.
- Take more trades but probably all terrible.
- More trades but all great because the pattern is well known.
#2 is exactly what happened. The pattern is still good (I’ve seen it work many times) but because there’s a lack of volume and/or trades occurring, the stock does not move up and has a higher probability of working as a short.
As you can tell from the entries/exits from below, the trades didn’t exactly work. Both setups do look pretty good so it is trading the right pattern, and the second one actually worked. It didn’t hit the target so it stopped out near break even. The problem is if you look at the 1 minute chart it’s extremely illiquid with gaps and barely any volume on each 1m candle.
I believe this stock came from the
TOP_OPEN_PERC_GAIN scans. These are good basic scans but they don’t tell you anything useful except that the stock is up on the day. IB allows you to see the volume and trades for each candle but I have yet to find a good indicator to determine how “hot” or volatile a stock is.
I could look at the volume of each candle or trades per candle or even relative volume. It’s not that meaningful though since what happens when the pattern occurs perfectly before the volume conditions are met then it takes the trade at a later time and it ends up with a loss. I’ve had this happen with relative volume > 1 checks. Volume pours in immediately after the pattern sets up and you get in too late and buy high or short low.
There are other scans like
MOST_ACTIVE that return the stocks with the most volume/trades/trade rate so I will be testing those to see what it trades. I have a decent algo for trading flags now, so it just needs to be applied to the correct stocks.
Fall has just started, which is a great time to be trading with real money, so I’d really like to get this working. I could set the API to read-only and see what it wants to trade that way, but it’s just not the same and you don’t get a complete picture of what it’s doing with fills/moving stops/random bugs.
I went through a few of the different scans and landed on
TOP_TRADE_COUNT. The latter is what it originally traded with when it had the bug I described earlier. Both of these scans seem to return similar stocks so it should cover all the bases (lots of volume / lots of trades). After changing this, it traded $CRBP at 11:57 AM while I wasn’t even here.
It should have gotten in on the previous candle but it was not up enough on the day to warrant a flag. Still making minor adjustments.
I recorded a lengthy video of me trading $VTVT manually on a 1m setup then a perfect 5m bull flag formed and my algo took it a few seconds after me. I’ll try to post more of these if I get something interesting.
I am not a registered financial adviser/broker/anything. Use this information for entertainment/informational purposes only. Any tickers mentioned are not recommendations to buy/sell/or sell short. They are used as examples only.
Please remember that past performance may not be indicative of future results.