Trading Update - 1

Is anyone reading these? They’re mostly to track my progress so I guess I don’t care too much.

I’ve stopped creating watchlists and have not made a trade since $AMD earnings a few months ago. I haven’t found watchlists to ever be helpful for some reason. I’d mark support/resistance and areas I’d like to get in at but they’d never do what I want or I wouldn’t pull the trigger. Most of the time you’re just playing the stock too late and it isn’t volatile enough the next day.

I’ve found looking at the top gainers / losers in premarket with a fresh catalyst is much easier. Identifying the premarket trends with daily support/resistance levels then trading based off the trend changes makes it easier, too. It’s still really difficult because sometimes the stock just doesn’t do what you think it would, or you don’t pull the trigger and it does exactly what you want.


Anyway. The last few months I’ve still been working on trading algorithms for stocks. It’s taking forever to get each algorithm perfected because you can’t just backtest one stock going back 100+ days to make sure it works. Each day is different because of news and which stocks gap up/down the most. It will rarely, if ever, trade the same stock the next day. The patterns are valid but the pattern may not occur on the same stock going back X days.

The cool thing is it has made profitable trades going long and short (paper trading of course). Just yesterday it traded $SAIL on a red to green move and made a quick 50c/share. Today it took another red to green setup but it got in too late after the whole move was made. It could have been profitable but the volume came in after it already spiked (I have a relative volume check to filter out junk). So relative volume finally met the requirments after it made the move. It bought too high and got dumped on for a 25c loss.

I have to go in and optimize it to make sure it does not buy too far off from the open price. It’s a tedious process that takes forever because it might not take a trade for a whole week. I’m able to backtest using IB’s tick data on each individual trade to make sure it has proper entries and exits.

Another cool thing is one of my strategies I found because of Kunal Desai from Bulls on Wall Street (I’m not affiliated with them in any way) months ago. I was in his webinar and he was asking people to give a good example of an “opening range breakout” that occurred that day (it was technically a bull flag so I don’t know why he labeled it an ORB). Well, guess which stock my algo traded that day? $VRAY. The exact same one he said was a perfect example.

$VRAY

Example backtest:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Starting backtest on $VRAY...
Retrieving intraday candles/ticks...
Retrieving daily candles...
Backtesting 07/25/2018...
[07/25/2018 09:45:00] Entry @ $11.40, target $12.20, stop $11.12 [ Bull Flag ]
Trailing stop: 11.12, 11.42
[07/25/2018 09:50:00] Exit @ $12.22 [ $0.82 ]
P/L: $82.00
Gross P/L: $82.00 / $0.00
Commissions: $-4.00
Net P/L: $78.00
Win/Loss: 1 / 0 (100.00% / ∞)
Trades: 1 (1 long, 0 short)
Avg $ win/loss: $82.00 / $0.00
Best/Worst: $82.00 [ Bull Flag ] / $0.00 [ ]



Here’s an example of a trade it took recently on $CRTO. This is a bear flag chart pattern and it ended up working perfectly. It nearly caught the exact bottom which always impresses me. I let the algo do everything. I wanted to bail and/or take profit as soon as it dumped but I let it do its thing. I believe this was the largest move it ever captured. It was about 98c/share.

$CRTO 5 minute candles

Example backtest:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Starting backtest on $CRTO...
Retrieving intraday candles/ticks...
Retrieving daily candles...
Backtesting 08/01/2018...
[08/01/2018 09:50:00] Entry @ $26.41, target $25.41, stop $27.19 [ Bear Flag ]
Trailing stop: 27.19, 26.86, 26.52, 26.39, 26.21
[08/01/2018 10:10:00] Exit @ $25.38 [ $1.03 ]
P/L: $103.00
Gross P/L: $103.00 / $0.00
Commissions: $-4.00
Net P/L: $99.00
Win/Loss: 1 / 0 (100.00% / ∞)
Trades: 1 (0 long, 1 short)
Avg $ win/loss: $103.00 / $0.00
Best/Worst: $103.00 [ Bear Flag ] / $0.00 [ ]

Note the entry and exit is not exactly the same as the trade it took. This is due to it taking the trade on the exact tick that met the requirements to short and not with a 5 second delay.

If anyone is interested in this, here’s a few things I’ve learned:

I’m no expert and I’m still working on my algos so take this advice with a pile of salt.

  • MACD / moving average crossovers / other indicators are never going to work alone.

In hindsight they appear to work, but should only be used to confirm what you already know (aka a chart setup). One of my initial attempts at writing an algorithm used the MACD and it worked flawlessly on $ECYT but never anything else. I had to abandon that idea because I simply couldn’t filter out enough junk to make it work on multiple stocks.

  • Volume is very important for trading stocks.

Not just “minimum 100K traded on the day” but above average volume (aka relative volume greater than 1). IEX has a completely free API that can be used to retrieve the daily chart history for calculating relative volume. This will remove 90% of the bad trades alone. My algo trades significantly less since I’ve added this.

  • Range is also important.

What’s the point of trading some stock that has volume if it’s only moved 10c on the day? There should be decent range, at least 20c.

  • I threw out my old indicator based algos and decided to write code to identify chart patterns/setups that are likely to work.

So for instance the red to green move I mentioned above, that is a setup I’ve seen work over and over again and I use indicators to confirm the setup. It should be above VWAP and above the 9 EMA if it’s a long (or below those if it’s a short). If it meets all of the critera, it will take the trade.

This is what every “guru” teaches anyway, right? Chart patterns. Well, why not automate it?

  • Determining to exit a trade when it isn’t working is very important.

I look at multiple topping wicks / dojis / bottoming tails and multiple candles topping at a certain price to determine when it’s not working. Most of the time you get a nice bounce over your entry after a dip. So when the stock starts to top and can’t breakout of a range, you should just get out for a small win. This also prevents you from taking a larger loss because your stop wasn’t hit yet. When it bailed due to an exit indicator I have yet to see the setup go in my favor afterwards. The setup should work relatively quickly.

  • 1 minute chart is noisy and real time tick by tick candles are not necessary.

All of my intraday strategies work off the 5m chart with a delay of 5 seconds. There’s generally way too much crap happening on the 1m and if you try to algo trade off it, you’ll get stopped out all the time. Sometimes you have to give the setup time to work and 5m setups tend to be cleaner anyway.

  • Whole dollars reject and support all the time.

This is common knowledge and it’s psychology. I tend to target below a whole dollar for a long setup because they often reject or support. Also, I don’t buy or short near whole numbers for this same reason. If you short into a whole number, it’s probably a bottom or at least a temporary one that will stop you out. This has happened so many times that I had to add code to check for it.

  • “Perfecting” an algorithm takes time.

I’ll reiterate what I said earlier. No matter how clearly you define your strategy, you’ll most likely still end up with it taking bad trades because of something you forgot to check for. Especially since this is for stocks and you can’t backtest every single stock in the entire market over a period of months or years. This does not mean you should constantly change your algorithm. Sometimes the setup just won’t work.

  • Backtesting is useful.

I had to write my own backtesting code to utilize TWS tick data and IEX daily candle data. It wasn’t too difficult and the results are very helpful. Once I fix a bug in a strategy, I try to go back to a previous pattern / stock it traded and make sure it still does the same thing. Also, you need to use tick data for this! Simply using candles only does not give an accurate entry or exit.

  • Trailing stops lock in profit.

Once you’re in a trade and up say, 50c, move the stop to break even + a few cents so you cannot lose. Afterwards, only trail the stop if a previous low, VWAP, or EMA is above your entry. This will help follow the stock up and maximize gains. This is something that can be done after you have a working strategy. This is where backtesting is useful.

  • Patterns occur on stocks of all price ranges.

My algorithms have traded stocks ranging from $3 to $50. The price doesn’t matter so long as you take the same percentage gain out of it. You can limit your max share size (100) and max dollar value ($2,000) in a trade to minimize risk when trading higher priced stocks.

  • Writing your own trading application can be done using the TWS API and free APIs from IEX and tiingo.

If I was not using IB, I would not be able to write my own algo trading application. I probably wouldn’t have even gone down this road if they didn’t have an API.



So that’s where I’m currently at. Refining algorithms so I can eventually trade them with real money in the future. I still want to get better at trading in general so I can make money that way without algos and write new algorithms based on new things I learn.

I feel like I should mention that I have not read a single book about algorithmic trading, yet. I bought an intro book by Kevin Davey after seeing a webinar he did for TradeStation. That will arrive on Sunday.

This took a while to write so if you found this helpful, consider sending me a tip:

BTC: 12BMo7nBeBhDGDGagwqSRPAv3fkQi8nCfq
BCH: qrjulqz4ceapc0fp2449apu6g769mef3j5std2sl9r
LTC: LVSmZByqa6Cp1BFwgqeUyMjKmpfHP23ApR
ETH: 0xd163fdde358f9000A4E9290f23B84DFb6E9190D3
ETC: 0x4c60D3527AE8ea7b2085E4E399C47361E8ddc04b
DGB: DT4KW5ZJ56vqayBdftjbTftsXwCXyymXK7



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.