Trading Update - 5

Update 6 - Live
Update 4 - Bull Flag 1 Results
Update 3 - Bull Flag 1 Trades

This algorithm is slightly modified compared to the update 3 post. Since the beta version of the TWS API contains better filters, I’m now using those instead of basic volume/market cap filters. I’ll try to upload them to YouTube, but if it’s anything like last time it’s just boring trades that get stopped out.

11/1/2018
Three trades today. Two wins and one break even trade. There may have been trades prior to these but this is when I got the scans and algo setup correctly.

$CLVS 5m/1m candles

Forgot to add this Greek shipping stock to the ignore list.

$PXS 5m/1m candles

Break even. Spreads were really bad on this one. Almost hit the target before getting stopped out.

$HUYA 5m/1m candles

11/2/2018
No trades. Yesterday was crazy and now Friday is pretty boring. I had some issues with my TWS layout around 11:30 so it was not watching for about 30 minutes.

11/5/2018
Basically nothing moving today. Market is pretty dead. Could be the upcoming election or the tarrifs.

It tried to take $GALT but it wouldn’t have gotten filled at 5.78, so I moved the order up. Tiny move to 5.89 then it started to dump. I’m not counting this one because the spreads would have made it cancel the order.

$GALT 5m/1m candles

11/6/2018
No trades. Hopefully something happens tomorrow after the election results are in.

11/7/2018
There were a few things moving finally but nothing crazy. $SEND made a huge move on earnings but I looked at the daily and didn’t see big volume while it was flagging. I backtested it and it won but no trades because the market cap is 1.6B (scan limit is 750M). No trades.

11/8/2018
I was messing with the scans for a few hours so it made a bad trade on $SGMS which is not a low market cap. I then got the scans dialed in better and it traded $LCI for a win. I should probably start the test over with the new filters. I think IB removed the “shares outstanding” scan because it’s not there anymore in the parameters. I wish they had a float filter because that would narrow it down significantly.

This one actually hit the non-weak market target, but I moved it down not expecting it to run that much.

$LCI 5m/1m candles

11/9/2018
No trades. Very boring day. It wasn’t even watching any stocks until 10:00 AM because everything sold off.

11/12/2018
Weak again. I really needed to dip buy $AMD at $19.00 so I logged into my live account and put some orders out. Algo was watching like 8 stocks by 10:30 so I doubt there was anything happening today.

11/13/2018
It’s just getting boring now so I’m running it on my live account but as read-only so it logs the trades but won’t be able to place them. I need to be able to make trades if I see something good instead of just paper trading it. I sold my small $AMD position today since it got a $1 run and I didn’t want to bag hold if it dumped. I have an order to rebuy at $19 again.

11/14/2018
No trades.

11/15/2018
Tried to take a trade on $SWCH but no fill. Order was canceled.

11/16/2018
Finally a trade and it somewhat worked. Unfortunately, it was $NBEV so it usually stuffs. Small move up to $4.50 then it dumped and got out break even. I’m adding a whole/half dollar top check because things like that happen often. Any human watching it could determine there was going to be resistance there or by looking at the level 2. I saw a higher number of sellers, then a bunch of sellers came in a penny below once it tapped it.



$NBEV 5m/1m candles

11/19/2018
No trades.

11/20/2018
No trades.

11/21/2018
No trades. A few small caps were strong today unlike the previous few days.

I took a look at $ABIL since it had a perfect 5m flag and the algo didn’t take it. The high of that flag went up more than 1% so it didn’t trade it. Percentages tend to mess with the strategy on lower priced stocks. I added an ATR check just like I did on the “big move” candle. That may increase the number of trades but lately there hasn’t been much going on.

I’ll probably start the test over once I’m satisfied with it. I’d like to get it to a point where I can trust it to make good decisions if I need to step away for a couple minutes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Starting backtest on $ABIL...
Retrieving intraday candles/ticks...
Retrieving daily candles...
Backtesting 11/21/2018...
[11/21/2018 10:05:00] Entry 52 @ $4.37, target $4.81, stop $4.18 [ Bull Flag ]
Trailing stop: 4.18, 4.40
[11/21/2018 10:10:00] Exit @ $4.82 [ $0.45 ]
Drawdown: $0.41 / -8.76%
Max profit: $0.36 / 7.67%
P/L: $23.40
Gross P/L: $23.40 / $0.00
Commissions: $-2.00
Net P/L: $21.40
Win/Loss: 1 / 0 (100.00% / ∞)
Trades: 1 (1 long, 0 short)
Avg $ win/loss: $23.40 / $0.00
Best/Worst: $23.40 [ Bull Flag ] / $0.00 [ ]

11/22/2018
Thanksgiving holiday.

11/23/2018
Good setup and I was asleep for this one. It would have been cool to see what happened if it traded something after hours since it was a half day.

I just noticed there was a perfect 5m setup earlier but it did not close high enough so it didn’t meet the requirements. I backtested a few stocks after changing it and didn’t really change much so hopefully going forward it has more trades. I don’t know if that’ll be good or bad.

$OSTK 5m/1m candles

11/26/2018
Insane move on $ANY today with lots of other stocks getting halted. I scalped it earlier then the algo took it a little later and I was not expecting it to work. Stop loss ended up being perfect.



$ANY 5m/1m candles

11/27/2018
No trades. Pretty boring.

11/28/2018
Market bounced really strong today. This is the first flag I’ve seen it take near market close. I have it set to exit the position when it’s after 15:50.

$PYX 5m/1m candles

11/29/2018
Traded $ALQA for a loss. It should not have traded this one because it dipped too low off the high. I already have code to check for that but it’s percentage based which ends up not working for all price ranges. I changed this to an ATR check as well.

If those two bottom candles before the entry held a little higher like $3.45 or $3.50 instead of $3.30 it would have been a more valid setup with a higher likelihood of working. Instead, it held lower, so the first candle to make a new high works better as a short unless it has insane volume to carry it.

$ALQA 5m/1m candles

11/30/2018
I scalped the crap out of $ADIL earlier so that’s why there’s a lot of trades. This setup is not exactly ideal but it did get a bounce into $5.00 before dumping.

$ADIL 5m/1m candles

These trades seem a little weird to me. On both of them it got filled really low instead of near the high. Could just be the spreads and when it polls the candle data.

$AGE 5m/1m candles

Last trade was on $NTEC. I can’t retrieve the chart in IB, but it was a $1 gain since it chopped around after the flag. Got out because of an exit indicator.

12/3/2018
First large cap trade. It shouldn’t have even traded it but due to a scan “bug” it ended up watching it. Setup was perfect so it did work but the entry was too high.

Update: It got in too high because of that ATR check I previously added (dumping too far off the highs). It wasn’t the check itself but because it was checking the wrong index in the ATR array. In fact, it was doing that for every single indicator like EMAs. Luckily, the indicator values would not change too much from each candle so each previous trade would work the same way. Glad I found that bug.



$TWTR 5m/1m candles

12/4/2018
Realtime chart data in IB was broken today. After receiving the initial chart data it would no longer update the candles correctly. The bid/ask would not match up with the candle. They did send out a bulletin saying to use directed charts which does work but I can’t find a way to auto select “ARCA”. Anyway, I don’t think this would affect the algorithm since it requests the chart snapshot and not tick updates.

No trades. Market had a nice crash midday.

12/5/2018
Stock market is closed.

12/6/2018
No trades. Since the market was really wild today I decided to backtest $TQQQ and it ended up taking a perfect flag and it got the full move out of it. I’m adding that to the list to see how it does each day. Could be interesting.

12/7/2018
Perfect timing. I added $SQQQ as well and it ended up trading it shortly after $TQQQ had a bear flag. First trade that it was able to ride the 9 EMA up.

(this video managed to get more views than usual due to people learning about inverse ETFs when the market was dumping)



$SQQQ 5m/1m candles

About an hour later it traded $MNTA. It ran enough to put the stop near the whole number, but that unfortunately caused it to get stopped out. I don’t really want to change the stops so I think I need better price targets or the ability to detect exponential moves.



$MNTA 5m/1m candles

Lastly, $DOMO near the close. Out for basically break even. The algo automatically sells when it’s after 15:50.

I did record this one, but I’m not going to upload it because the stock did nothing then it exits at 15:50.

$DOMO 5m/1m candles

12/10/2018
Lots of volatility in the overall market with not many stocks up. This setup is not exactly ideal since it had that huge wick and it does not have much volume. Algo sold earlier than the stop because it topped at the half dollar. I think that was right move because it tapped the stop then bounced to the entry afterwards.

$XPER 5m/1m candles

Later it took $INNT but did not get filled so I manually put the orders in. I backtested it had an entry of 2.99 with an exit at 3.02 which is basically what my manual trades reflect.

$INNT 5m/1m candles

12/11/2018
Two trades back to back. $SPY was kind of all over the place in the first few minutes so I expected $TWTR to just roll over with it.



$TWTR 5m/1m candles

I thought there was a daily flag setup on this one but I guess not. Basically caught the exact top. Amazing.

$ASNA 5m/1m candles

12/12/2018
This setup ended up being perfect but the timing was off. On the 1m there is a perfect ascending triangle that exploded when it finally broke out. You could say that it’s still too extended based on the distance from the 9 EMA, but how many good trades would it remove from the list?

$SFIX 5m/1m candles

This is the 3rd or 4th time it has traded $NBEV and it rarely ever works. I’m adding it to the ignore list.

$NBEV 5m/1m candles

Not an ideal setup. It’s traded a few of these previously because I decided to change the high check from close - open to high - open to see what it would trade. I’m not sure if that change works better or if I should just check to make sure it’s not buying over the high.

$HUYA 5m/1m candles

12/13/2018
Not an easy day. Most traders I follow on Twitter are struggling today or red. I decided to sleep.

My algo was watching only 32 stocks today. Usually by end of day it’s at least 50 on a bad day or 80+ on a day where the market is up/moving.

It traded $HUYA again but three times today. First one had a little move then a loss. Second one got the full move for a win. Third another loss. Still positive on this name believe it or not. For this stock it seems like moving stops up really causes a problem. After each entry it ends up being choppy without breaking out quickly.

The last trade it took on this one (top right) is another “not ideal” setup. The stock is not what I’d consider “up” at that point to take a flag trade. The previous two were even though only one really worked.

If you go back to $DOMO, that one is technically OK (I mean look at the candle tops, too perfect) but it was just too close to the close for it to make a move.

$HUYA 5m/1m candles

Next was $SQQQ for a loss. Got a little move then it crashed. I don’t have enough data to know how accurate it is on the overall market so this could just be one of the times it did not work.

$SQQQ 5m/1m candles

12/14/2018
The past few days have been pretty boring. Another $HUYA trade and another one for the overall market.

This one shouldn’t have actually been traded because it didn’t get a fill then it tried to re-enter a few minutes later on the next candle. The setup was decent but it just dumped then decided to try buying again.

$HUYA 5m/1m candles

Setup seems OK but the market has been too choppy lately.

$TQQQ 5m/1m candles

Live

I’m thinking about going live on Monday depending on how the market looks. This algo is to the point where it’s able to identify bull flags very well and most of the time when it gets stopped out it could have had a profit. I’ll be managing the trade how I see fit because sometimes it’s just too obvious that it’s about to dump ($SFIX / $HUYA recently).



12/17/2018
I was too tired to get up so I didn’t go live. No trades today anyway. I’ll try again tomorrow.

12/18/2018
I finally let it trade live. Nothing really going on today though. Could be the holidays or the market being slow / choppy. $MTLS had a perfect 5m flag setup but the volume was too low.

I shut it down early at 12:00 PM since most of the trades occur before that time. If it hasn’t made a trade by then it probably won’t later on. Not worth waiting around all day for it. Besides, it’s only watching 23 stocks which means there’s nothing moving. As I said previously, on good days it’s watching 50 stocks by 10:30 / 11:00.

Let’s see what happens tomorrow.

12/19/2018
I wasn’t up today. Fed announcement at 2:00 PM so I wasn’t planning to let it trade. No paper trades before 12:00 so it didn’t matter anyway.

At 1:05 PM it tried to take $WGO but no fill. Slow grind up. It would have exited for a $10 gain due to the maximum hold time being 35 minutes. Not bad.

A little later $MRIN which was a good setup but it was a bit extended to keep going. I think the ideal times are 9:50 to 12:00 then 3:00 until end of day.

12/20/2018
I don’t really trust flags to work in this market so I’m hesitent to go live again. If I do then I’ll have to transmit the orders manually to be on the safe side.

This one sort of worked but it dumped first. Probably could have made it all back going long on the candle that broke above VWAP.

$INPX 5m/1m candles

Dumped immediately on the entry. Choppy flag though.

$OSTK 5m/1m candles

12/21/2018
I started working on a similar bull flag algo that looks for perfect pennants and bull flags. Both flags have the highs being lower on each candle but with a pennant the lows uptrend. They are slightly different but I think that might work a little better in terms of improving accuracy. If the setup looks perfect more people are able to recognize it and see what’s likely to happen next.

Next week is shorter plus a half day on Monday. Last few weeks have been slow so hopefully next year there will be some better opportunities for flags.

One trade on $PTI today but it couldn’t even get to the target so it had a $1 gain. Not a bad setup besides that giant wick. Just not enough movement. I may experiment with using the 9 EMA as the stop instead so it always trails it up. A lot of the time it gets stopped out due to moving it up to break even and it dumps then runs. It’s a difficult balancing act.

$PTI 5m/1m candles

12/24/2018
Half day today. One trade on $MRIN which worked OK but had a double top then dumped. There was actually a deadlock so it didn’t exit until the stop was moved up and it dumped into it. This flag is part of my new pennant algo. It would have still been taken by the original algo.

Market is closed on Christmas then normal trading hours the rest of the week.

$MRIN 5m/1m candles

12/25/2018
Christmas.

12/26/2018
Insane bounce today. Only one algo trade from the previous bull flag algo. I really don’t think this old algo is going to ever work because it’s not precise enough. Sometimes it gets some huge gains but most of the time it get stopped out.

$CRC 5m/1m candles

12/27/2018
Nice move out of $WATT today. Two flags but it only took one of them because the first one broke the high of the flag top and it does not chase. I’ve added code to buy on the dip if it comes back down below the previous candle high.

I actually had it running live but not transmitting orders. I should have just taken the first one on my own when it dipped. If I used the same risk level it would have been perfect.

1
2
3
4
5
6
7
8
9
10
11
12
13
[12/27/2018 09:50:00] Entry 40 @ $6.45, target $6.98, stop $6.20 [ Bull Flag ]
Trailing stop: 6.20, 6.48, 6.51
[12/27/2018 10:15:00] Exit @ $6.89 [ $0.44 ] (exit indicator)
Drawdown: $0.08 / -1.25%
Max profit: $0.60 / 9.40%
P/L: $17.60
[12/27/2018 10:40:00] Entry 34 @ $7.17, target $7.76, stop $6.88 [ Bull Flag ]
Trailing stop: 6.88, 7.20
[12/27/2018 10:50:00] Exit @ $7.19 [ $0.02 ]
Drawdown: $0.28 / -3.86%
Max profit: $0.25 / 3.45%
P/L: $0.68

$WATT 5m/1m candles

12/28/2018
Holidays plus a Friday so it’s watching only 5 stocks by 10:00. I let it trade live until 11:00 but it was only watching 13 stocks by then. Just a really boring day.

I’ve started adding crypto trading support and so far the same bull flag algo appears to work on the hourly chart for Litecoin. I need to optimize it a bit and figure out how to get 1m candles past a few months so I can properly backtest it.

12/31/2018
Last day of the year and it’s a half day! Market is closed on the 1st. I’m letting the algo trade the pennant’s live and normal bull flags will be submitted but not transmitted. This gives me the ability to choose which trades it takes.

I’ll be writing another trading year review today like I did for 2017.

No trades today. I’m almost done with the algo order flow for GDAX.

Live

I’ve already been going live but now I’m moving those trades over to a new post. Hopefully we see some nice moves in the first few months of 2019!



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.