Trading Update - 2

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Starting backtest on $SYN...
Retrieving intraday candles/ticks...
Retrieving daily candles...
Backtesting 09/28/2018...
[09/28/2018 10:10:00] Entry 50 @ $4.15, target $4.57, stop $3.88 [ Bull Flag ]
Trailing stop: 3.88, 4.01, 4.15
[09/28/2018 10:15:00] Exit @ $4.59 [ $0.44 ]
Drawdown: $0.33 / -7.85%
Max profit: $0.52 / 12.66%
P/L: $21.89
[09/28/2018 11:00:00] Entry 25 @ $6.65, target $7.32, stop $6.06 [ Bull Flag ]
Trailing stop: 6.06, 6.65, 7.01
[09/28/2018 11:10:00] Exit @ $7.33 [ $0.68 ]
Drawdown: $0.32 / -4.94%
Max profit: $1.26 / 19.44%
P/L: $17.00
Gross P/L: $38.89 / $0.00
Commissions: $-4.00
Net P/L: $34.89
Win/Loss: 2 / 0 (100.00% / ∞)
Trades: 2 (2 long, 0 short)
Avg $ win/loss: $19.44 / $0.00
Best/Worst: $21.89 [ Bull Flag ] / $0.00 [ ]

After fixing it on Friday I figured on Monday it would do one of the following:

  1. Still take the same amount of trades because the ideal perfect setup is not occurring that frequently.
  2. Take more trades but probably all terrible.
  3. 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.

$NTGN 5 minute candles

$NTGN 1 minute candles (illiquid)

I believe this stock came from the TOP_PERC_GAIN / 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 TOP_TRADE_RATE / TOP_TRADE_COUNT / 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.


Scans

I went through a few of the different scans and landed on HOT_BY_VOLUME and 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.

$CRBP 5m/1m candles

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Starting backtest on $CRBP...
Retrieving intraday candles/ticks...
Retrieving daily candles...
Backtesting 10/02/2018...
[10/02/2018 11:50:00] Entry 50 @ $7.47, target $8.22, stop $7.28 [ Bull Flag ]
Trailing stop: 7.28, 7.47, 8.01
[10/02/2018 12:00:00] Exit @ $8.23 [ $0.76 ]
Drawdown: $0.17 / -2.25%
Max profit: $0.68 / 8.99%
P/L: $38.00
Gross P/L: $38.00 / $0.00
Commissions: $-2.00
Net P/L: $36.00
Win/Loss: 1 / 0 (100.00% / ∞)
Trades: 1 (1 long, 0 short)
Avg $ win/loss: $38.00 / $0.00
Best/Worst: $38.00 [ Bull Flag ] / $0.00 [ ]

$VTVT

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.






Disclaimer

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.