thinkscript - Python Trade Analyzer

thinkorswim allows you to create custom strategies and backtest them but it is missing useful stats like winning percentage. This simple Python script will parse the trades and output a few basic stats.

Save the report from thinkorswim and run this script in the same directory as it.

thinkscript - Bollinger Band Alert

This script will sound an alert when a candle is outside the upper/lower bollinger band. It also looks at the candle size based on ATR to filter out some of the alerts. It may alert several times per candle if it continously ticks above/below the bollinger band and it may disappear entirely if it closes inside.


Outside Bollinger Band
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
input bollinger_length = 20;
input bollinger_devs = 2.0;
input bollinger_price = close;
input atr_length = 14;
input alert_text = "Outside Bollinger Band";
input use_alerts = {false, default true};
input alert_type = {default "BAR", "ONCE", "TICK"};
input alert_sound = {"Bell", "Chimes", default "Ding", "NoSound", "Ring"};
def upper = BollingerBands(length = bollinger_length, price = bollinger_price, "num dev dn" = -bollinger_devs, "num dev up" = bollinger_devs)."UpperBand";
def middle = BollingerBands(length = bollinger_length, price = bollinger_price)."MidLine";
def lower = BollingerBands(length = bollinger_length, price = bollinger_price, "num dev dn" = -bollinger_devs, "num dev up" = bollinger_devs)."LowerBand";
def atr = ATR(length = atr_length);
def condition1 = (low < lower) and (close < open) and (open - close > atr);
def condition2 = (high > upper) and (close > open) and (close - open > atr);
def at = alert_type;
Alert((condition1 or condition2) and use_alerts, alert_text, if at == 1 then Alert.ONCE else if at == 2 then Alert.TICK else Alert.BAR, alert_sound);
plot Above = condition1;
Above.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
plot Below = condition2;
Below.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);



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.

Trade Review - April 2019

I kind of took a little break in April. I wrote an @ES trading strategy using thinkscript and I made a tutorial for how to get started with it here, and because of how good the results have been I added futures support to my algo trading app.

It’s been interesting to say the least. A few winners and a few losers. I’m impressed with the results in thinkorswim so I’ve been paper trading it and making sure the trades line up between them. I’ve let my other stock algos trade but they seem pretty inconsistent, and I think it might be impossible to trade flags due to how often they dump. I decided to reverse the flag strategy to short and I’ll have to see how well that does.

I feel like at this point I should just trade @ES futures (or the micro contract when it comes out this month) because of how terrible stocks are. You can’t know if a particular setup will work on the next “hot” stock that pops up. At least with my @ES strategy it’s been somewhat consistent compared to stocks.

Besides algos, I’ve been slowly building a position in $SDIV since it pays a nice monthly dividend and I’m not doing too much with my IB account. I have 75 shares at the moment and want to get more and hold for a while.

I think I will stop posting algo trade recaps since they’re only useful if I want to go back and see what it traded. If I start live algo trading again then I’ll definitely log them with screenshots and video logs. All trades are logged into a database anyway so I can see what happened.

That’s pretty much it. Still working on algos, but focused more on futures.



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.

EZ WireGuard Setup

Keys

Generate keys on both the server and client.

1
wg genkey | tee privatekey | wg pubkey > publickey

Server

1
2
3
4
5
6
7
8
9
10
[Interface]
PrivateKey = <server private key>
ListenPort = 51820
Address = 10.0.0.1/24
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
PublicKey = <client public key>
AllowedIPs = 10.0.0.0/24

Client

1
2
3
4
5
6
7
8
[Interface]
PrivateKey = <client private key>
Address = 10.0.0.2/24
[Peer]
PublicKey = <server public key>
Endpoint = <server public ip>:51820
AllowedIPs = 10.0.0.0/24

Run

1
wg-quick up wg0

Daemon

1
2
systemctl enable wg-quick@wg0
systemctl start wg-quick@wg0

Headless Fluxbox / TightVNC

This guide is for Ubuntu 18.04. I needed a super lightweight GUI to run some applications without installing a full blown desktop environment and this seemed like a pretty good option. I would not recommend using this over the internet without an SSH tunnel.

  1. Install fluxbox and tightvnc.

    • apt install fluxbox tightvncserver xterm
  2. Run the VNC server manually on the user so you can set a password.

    • tightvncserver :0
    • tightvncserver -kill :0
  3. Edit /etc/systemd/system/tightvnc.service (change the user/group if needed)

    • 1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      [Unit]
      Description=TightVNC
      [Service]
      User=ubuntu
      Group=ubuntu
      Type=forking
      ExecStart=/usr/bin/tightvncserver -depth 24 -geometry 1440x900 :0
      ExecStop=/usr/bin/tightvncserver -kill :0
      Restart=on-failure
      [Install]
      WantedBy=multi-user.target
  4. Start.

    • systemctl daemon-reload
    • systemctl start tightvnc.service
  5. If you want to run GUI applications from outside VNC, export the display.

    • export DISPLAY=:0
  6. To add a custom menu edit ~/.fluxbox/menu

    • Add below [begin]
    • [exec] (xterm) {xterm}

Backtesting with thinkscript

I cobbled together a bunch of examples I found through Google into the samples provided below. thinkorswim is not that great for this, but it does allow you to visualize trades and get some idea of how well a strategy works. However, there is no way to fully auto trade a strategy. It’s possible to trigger an order based on a strategy being “true” but I would not recommend doing so. One thing to note is the sound alerts do not work and I haven’t found a solution.

Limitations

  1. Strategy can only be backtested on the chart duration it is applied to. This means a full backtest of years worth if intraday data is not possible unless you use the “OnDemand” feature.
  2. Strategy results window only shows basic trade P/L and a total P/L. No information about winning percentage or useful averages.
  3. Targets/stops end up trailing if the value changes (ATR in this case) and I haven’t found a way to make them static. I found examples to do that but they never worked properly.

Warning about stops. If you start seeing drastic improvements to your algos losses, make sure thinkorswim did not remove the price field from the stop loss order. This seems to occur when you save the strategy and it contains an error.

Creating a Strategy

The strategy will now appear in the “Price” window.

You should now see some trades on the chart. If not, it means your strategy has no trades or there’s something wrong with your stop loss/profit target prices causing it to only show up one time.

Backtesting

Now that you have a test strategy that shows up on the chart, you can backtest it to see the P/L. The first thing you will want to do is change the timeframe to as far back as possible. On the 5m, thinkorswim only allows you to go back 180 days. You can experiment with different timeframes and using the “OnDemand” feature to go back to certain years.

Right click on any entry, target, or stop and go to “Show report”.

And here are the results of the “Long Example” below starting on 4/13/19 going back 180 days on the 5m chart.

The strategy technically made money, however, it’s wildly inconsistent. Just because it made money in the end does not make it worth trading.

Long Example

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
29
input contracts = 1;
input rsi_length = 14;
input atr_length = 14;
input profit_mult = 2.0;
input stop_mult = 1.0;
input alert_text = "Long Example";
input use_alerts = {false, default true};
input alert_type = {default "BAR", "ONCE", "TICK"};
input alert_sound = {"Bell", "Chimes", default "Ding", "NoSound", "Ring"};
def rsi = RSI(length = rsi_length);
def atr = ATR(length = atr_length);
def condition = (rsi < 30);
# Long
AddOrder(tickcolor = Color.GREEN, arrowcolor = Color.RED, name = "Long", tradeSize = contracts, condition = condition, type = OrderType.BUY_TO_OPEN);
# Profit
def target = EntryPrice() + ATR() * profit_mult;
AddOrder(type = OrderType.SELL_TO_CLOSE, high[-1] >= target, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Target", price = target);
# Trailing stop
def stop = EntryPrice() - ATR() * stop_mult;
AddOrder(OrderType.SELL_TO_CLOSE, low[-1] <= stop, tickcolor = Color.GRAY, arrowcolor = Color.GRAY, name = "Stop", tradeSize = contracts, price = stop);
# Alerts
def at = alert_type;
Alert(condition and use_alerts, alert_text, if at == 1 then Alert.ONCE else if at == 2 then Alert.TICK else Alert.BAR, alert_sound);

Short Example

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
29
input contracts = 1;
input rsi_length = 14;
input atr_length = 14;
input profit_mult = 2.0;
input stop_mult = 1.0;
input alert_text = "Short Example";
input use_alerts = {false, default true};
input alert_type = {default "BAR", "ONCE", "TICK"};
input alert_sound = {"Bell", "Chimes", default "Ding", "NoSound", "Ring"};
def rsi = RSI(length=rsi_length);
def atr = ATR(length=atr_length);
def condition = (rsi > 70);
# Short
AddOrder(tickcolor = Color.GREEN, arrowcolor = Color.RED, name = "Short", tradeSize = contracts, condition = condition, type = OrderType.SELL_TO_OPEN);
# Profit
def target = EntryPrice() - ATR() * profit_mult;
AddOrder(type = OrderType.BUY_TO_CLOSE, low[-1] <= target, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Target", price = target);
# Trailing stop
def stop = EntryPrice() + ATR() * stop_mult;
AddOrder(OrderType.BUY_TO_CLOSE, high[-1] >= stop, tickcolor = Color.GRAY, arrowcolor = Color.GRAY, name = "Stop", tradeSize = contracts, price = stop);
# Alerts
def at = alert_type;
alert(condition and use_alerts, alert_text, if at == 1 then Alert.ONCE else if at == 2 then Alert.TICK else Alert.BAR, alert_sound);

Buy Open/Close (stocks)

Buy Close Sell Open

1
2
3
4
5
6
7
8
9
10
11
input Size = 100;
input OpenTime = 0930;
input CloseTime = 1600;
def condition = SecondsFromTime(CloseTime) == 0;
# Buy
AddOrder(type = OrderType.BUY_AUTO, tickcolor = Color.GREEN, arrowcolor = Color.RED, name = "Long", tradeSize = Size, condition = condition, price = dailyClose);
# Sell
AddOrder(type = OrderType.SELL_TO_CLOSE, SecondsFromTime(OpenTime) == 0, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Target", price = dailyOpen);

Buy Open Sell Close

1
2
3
4
5
6
7
8
9
10
11
input Size = 100;
input OpenTime = 0930;
input CloseTime = 1600;
def condition = SecondsFromTime(OpenTime) == 0;
# Buy
AddOrder(type = OrderType.BUY_AUTO, tickcolor = Color.GREEN, arrowcolor = Color.RED, name = "Long", tradeSize = Size, condition = condition, price = dailyOpen);
# Sell
AddOrder(type = OrderType.SELL_TO_CLOSE, SecondsFromTime(CloseTime) == 0, tickcolor = Color.GREEN, arrowcolor = Color.GREEN, name = "Target", price = dailyClose);

Some additions you could make to these is seeing if it closed red or closed green on the day.

1
2
def dailyOpen = open(period = AggregationPeriod.DAY);
close > dailyOpen

or buy only on specific days of the week:

1
2
def day = GetDayofWeek(GetYYYYMMDD());
(day == 1 or day == 5)

Stops

Checking for a double top:

1
high == high[1]

Checking for a double bottom:

1
low == low[1]

Ticks for a stop loss:

Add/subtract the tick size from the entry price depending on a long/short trade.

1
def stop = EntryPrice() + (TickSize() * 4);

Filtering Open/Close Times

1
2
3
4
5
6
7
8
input OpenTime = 0930;
input CloseTime = 1600;
# Between open/close time
def timeframe = SecondsTillTime(OpenTime) <= 0 and SecondsTillTime(CloseTime) >= 0;
# Outside open/close time
def timeframe = (SecondsTillTime(OpenTime) > 0 or SecondsTillTime(CloseTime) < 0);



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.

Trading Update - 9

Update 8

This post is dedicated to April trades. I won’t be doing a March recap post since I paper traded the entire time and have been tweaking it. The flags it trades are good, I think, so now I’m making sure the exit indicators work properly. I have started working on a shorting strategy that looks promising as well.

04/01/2019

  1. $MOMO. Two trades on this one today. First one worked perfectly and the second got stopped out break even.

No short trades surprisingly. I see $PHAS had a nice $12 wall which worked but was not taken because of the higher float.

04/02/2019
Flags

  1. $PSTG. Reminds me of the crappy stocks it traded last year with no volatility. Out for break even.
  2. $WDC. Got stuck at the half dollar so the algo sold early. It was definitely the right call as it dumped shortly after.

Shorts

  1. $MDR. Perfect setup however the stop was too tight. Worked exactly how I wanted otherwise.
  2. $STNE. Way too volatile and it got an insanely bad fill. Shouldn’t have been traded since the ATR is above the max I set. It did work eventually but the entry was horrible.
  3. $VKTX. Worked perfectly.

Couple bugs with stops but nothing major. I may change it to only short whole numbers if the stock is volatile. Half numbers actually seem decent but only if the volatility isn’t too insane.

04/03/2019
Flags

  1. $SGMO. Failed pretty much right away.

I feel like I need to rewrite my flag strategy but I don’t know what I would change. It trades the setup well but they seem really inconsistent.

Shorts

  1. $ON. Half dollar that didn’t work. It was close though.
  2. $GME. Basically top ticked the whole number. Could have gone for more on this one.
  3. $AMD. Quick scalp at the whole dollar.

It was also trying to short $ZYNE but IB had no shares and it worked perfectly too :(

04/04/2019
No flags.

Shorts

  1. $PVG. Didn’t quite dump enough to hit the target. Small profit.
  2. $I. Blasted through the short instantly.
  3. $LB. Perfect setup. Left some on the table but the volatility isn’t that high.

As I described on 4/2, one of the changes I can make is to not short half dollars if the volatility is too high. $I would have met that critera today.

04/05/2019
Flags

  1. $WLL. Top ticked the exit.
  2. $TGI. Instantly failed. I’m surprised it was taken since the top was at a whole number.

Shorts

  1. $ZYNE. IB had shares finally. Got stopped out pretty quick. It was close to getting the top.

Pretty slow day for shorts. I may rewrite my flag strategy this weekend to see if I can simplify it.

04/08/2019
Slow day. I added $SPY and $TQQQ to the short symbols list to see if it ever trades those and how well they perform.

Shorts

  1. $NBEV. No shares at IB. It was close to getting the big drop. This stock is impossible to trade due to the insane amount of shares it trades when there’s news.

04/09/2019
More trade war crap today. Really slow this morning besides $ATAI.

No trades. Barely anything going on again.

04/10/2019
I loosened up some of the filters for the shorting strategy to see if has any trades that work on higher priced stuff. Very slow day again.

Flags

  1. $AMRS. Got out on the next candle when it topped. Almost break even.
  2. $ZAYO. Same as $AMRS. Small win.
  3. $ATAI. Dumped first before going.

Shorts

  1. $ZAYO. Shorted the half dollar. Stopped out break even.

04/11/2019
The last few days I’ve been working on an ES long/short strategy using thinkscript since it allows you to easily visualize the trades and gives you a basic P/L for the time period you’re looking at. It looks promising so I want to add futures support to my trading app and automate it to see how it does going forward.

Barely anything going on. No trades except for ES.

04/12/2019
No flags.

Shorts

  1. $PE. Got a little dump then it broke out again. 10m later a massive crash.

Slow day again. I’ve been working on an ES strategy in thinkscript and porting it to my own algo when the results look good. I just need the setup to appear a few times so I can make sure everything works properly. So far I really like futures. Stocks just seem so unpredictable and fitting a strategy to the one that pops up for the day is really hard. There will be a micro futures contract for the S&P 500 next month so I’ll look into trading that instead of ES so there’s less risk.

04/15/2019
Flags

  1. $ADNT. Crap.

Shorts

  1. $ADSW. Perfect.
  2. $ADNT. Perfect.
  3. $CTLT. Nice drop then it spiked and got out break even. Not bad.
  4. $EFII. Crap. Massive crash after it went parabolic.
  5. $JMIA. Crap. Little dump at the half dollar.

The early shorts were incredible then every trade after was crap. I’m more interested in my ES strategies now since stocks are less predictable.

04/16/2019
No trades. $TIGR set up for a short but no shares available. Even ES was pretty slow today.

04/17/2019
Slow day but some nice ES trades.

Flags

  1. $LB. Total crap but got out break even.

Shorts

None.

04/18/2019
Market is closed on Friday. Some nice ES trades during premarket.

Flags

  1. $WTR. Stopped out right away. Eventually got going. Stop was too tight for a win.
  2. $HUYA. Stop was too tight again. Would have almost hit the target

Shorts

  1. $AMRS. No shares. It would have gotten stopped out anyway.

04/22/2019
Lately all of the flags and shorts have not worked and I feel like I’ve slowly moved on after seeing my ES strategy work consistently. It does not seem possible to make a strategy for random stocks that are active unless it is extremely specific. I would need to rewrite my flag algo to be more specific but then it might not ever trade. It would take a long time to get a large enough sample size to know if it works or not, and then it might only work during earnings or vice-versa.

For ES, the pattern shows up at least once per day and has been consistent. I’m still fixing a couple issues with it where it doesn’t take the same trades as the thinkscript due to indicators returning bad data. But so far every trade has been amazing. Hopefully it works on the micro contract when that is released otherwise I could take the trade manually on it instead.

Flags

  1. $RCII. Dumped.
  2. $WLL. Double topped so got out break even.
  3. $CRZO. Almost hit the target. Finally one that worked.

04/23/2019

Flags

  1. $HOME. Dumped pretty quick.

04/24/2019

Four ES trades today. Two were OK in the early morning and the other two were perfect.

Flags

  1. $STNE. Perfect.

04/25/2019

Some ES trades but nothing else.

04/26/2019

No ES trades today.

  1. $CRON. Dumped.

I feel like I have to reverse my bull flag algo since it’s insanely accurate about the stock going down. The first candle to make a new high ends up being the perfect short entry with a stop at the high of day.

04/29/2019

Small win on ES.

I reversed my bull flag strategy

Short flags

  1. $ROAN. Went a little bit too far so it got stopped out.
  2. $JMIA. Broke the high of day slightly then dumped. Perfect, just needs a stop loss tweak.

Shorts

  1. $BE. Ran hard after the entry.

04/30/2019

No ES trades.

Short flags

  1. $WDC. Didn’t really do anything after the entry. Consolidated then dumped. Tiny loss.
  2. $WW. Perfect setup. Dumped for 30m+.

Trade Review - April 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.

Potential Strategy - Overextended Short

I’ll start off by saying this is nothing new and Kunal Desai has written blog posts about a similar strategy involving bollinger bands. Unfortunately, I cannot find the link to it but I did see it while researching bollinger bands and stochastic RSI.

I’m subscribed to GDT on YouTube and during one of his recap videos it connected a few dots. What he has been doing lately is shorting extreme spikes expecting them to pull back enough to have a profit.

The particular stock in the video was $CPRX on 3/27. It spiked into $5.50 resistance (half dollar) then pulled back allowing for a quick 20c gain. And that’s what clicked in my head. Shorting into a whole or half dollar number - since it’s just psychology. People love to sell at or short at whole/half numbers.

I wrote a quick strategy to trade that stock then rewrote it the next day to simplify it. On Friday there were a few losses but also one giant gain that wiped out all the losers.

Let’s take a look at that nice gain on Friday. $WTW spiked very sharply near the open into a whole number. The algo shorted it at $20.98 with a stop of $21.05. It was out within the next 5 minute candle for an easy win.

The goal of this strategy is to short into a wall of resistance and get out as quickly as possible for a win. Even though this stock dumped for hours that may not be the case for each trade. I only have a small sample size at this time, so I may need to change that in the future in case this strategy really works.

The Requirements

  1. Must be at the whole/half number (within 2c on either side of it).
  2. The candle high it shorts needs to be outside the upper bollinger band.
  3. RSI must be above 70.
  4. Stoch RSI must be above 80.

Some tweaks I may consider:

  1. Whole numbers only (half numbers may not be as consistent).
  2. Daily resistance (could increase odds).

$WTW 5m candles

I’ve since added support for finding resistance on the daily chart (can be toggled) that coincides with the whole/half number. In theory that should increase its odds of having a win.

As you can see from the chart below, there was indeed resistance on the daily chart at $20.99. It’s never exactly the whole/half number and it’s more of a range like within 15c.

$WTW daily chart



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.

Trading Update - 8

Update 7
February Trade Review

This post is dedicated to March trades. I paper traded most of February and modified the algo a bit to fix a few bugs and add new exit indicators. See the “Februray Trade Review” link above to find out what I changed. I plan to paper trade for at least the first week March if not more.

03/01/2019

  1. $LB. Traded this one before. Small move then crashed. Worked eventually so I think I need to use the 9 EMA if it’s lower as the stop.
  2. $FTCH. Also traded this one before. Dumped pretty quickly.
  3. $VFF. Another instant dump.
  4. $OSTK. Nice looking setup that dumped. Usually flags work on this stock.

Friday’s just seem to be terrible in general. Most likely when I go live again I’ll skip Friday entirely.

03/04/2019
Not watching many stocks by end of day. There were a few that popped up but didn’t meet the risk/reward or failed before making a new high. I’m using the 9 EMA as a stop or a previous low so the risk/reward must be much higher in order for a trade to occur.

  1. $SE. Late day flag and it worked. My algo did sell it sooner than usual because it got super close to the target and didn’t get over quick enough. It needs some adjusting to wait several seconds then sell but it does work. Nice win.

03/05/2019

  1. $SE, again. No fill and if it were live I doubt it would have gotten it. It did end up working.
  2. $SE. Second flag failed.

03/06/2019
No trades. $BPTH would have been taken but the R/R was bad. The backtest shows a 1.45:1 risk/reward which is good so maybe I’ll use the last close price instead of the high for the calculation during live trades. It should have been taken which is weird.

03/07/2019
It was going to take $BPTH early in the morning today but the R/R was just awful and I’m glad I added that. The downside is multiple dollars and the reward I programmed is not capable of more than about $1 max.

  1. $YEXT. Good setup, break even though. It did double top so maybe I need to look back a couple candles before the entry. Eventually hit the target.

So far no dumb trades this week. Could just be from the market dumping and these are the only ones that met the requirements. Tomorrow is Friday which has been god awful lately. I did make a few changes after the last one so maybe it will do better.

I updated the crypto datasets if anyone cares.

03/08/2019
No trades. Pretty slow day in general.

03/11/2019
$WDC was setting up and would have worked but the risk was too high for it to trade.

No trades.

IB did something with TWS in the latest update that caused the charts and the entire application in general to be extremely laggy, and it has nothing to do with memory leaks this time around. 974 seems to be fine and luckily I had that older standalone release in a VM.

03/12/2019

  1. $PYX. This turd never works. It bought right into daily resistance. I’m not sure if I can determine if there is resistance other than looking at the highest high over the last 30 days or so.

03/13/2019
$NTNX in the morning but risk/reward was bad.

  1. $SLDB. Another failed flag that eventually hit the target.

I don’t know what I’m missing. These setups all look pretty decent to me yet almost all of them dump.

03/14/2019
Nothing going on again. I paper shorted $BOXL as it spiked into resistance. First entry was a bit early then I added higher into 4.18 which was just about the high. Really nice trade.

No trades.

  • I’m going back to previous low as a stop since the 9 EMA tends to be really far away. In the case of the EMA, it ends up taking even smaller positions and gets stopped out anyway. It doesn’t seem to matter.
  • I made some backtesting changes to make things a lot easier to test “waiting” a set amount of time before selling when a double top occurs. Eventually I want to add resampling 1m candles instead of ticks so I can backtest days at a time for faster results.

03/15/2019
Friday! Still not much going on. $SLNO had a flag that occurred the earliest I’ve ever seen. It did work but was not taken because it broke the 9:30 high candle.

No trades again. I tweaked it some to support super early flags but it still wouldn’t take it if the risk/reward was low.

03/18/2019
Both of these morning trades got stopped out due to a bug. What happened is they topped and failed but eventually broke out then it sold because the time of the tops was not cleared. Always good to find bugs like these before trading live.

  1. $VFF. Slow but worked perfectly and hit the target. Top was 5c higher.
  2. $AA. Got a little move but just couldn’t make it to the target.

03/19/2019
No trades. It was not watching much from the scans so probably not a whole lot going on. $AMD managed to spike and of course it didn’t crash enough yesterday to fill me.

03/20/2019

  1. $WLL. Stopped out break even as it tapped the stop then ran.
  2. $NTNX. I was in the shower for this one. Perfect.

I’ll test moving the stop to break even later on and using the 9 EMA instead if it’s up enough. I still don’t have an idea of the ideal amount of time to move a stop or even what price to use besides trailing an EMA.

03/21/2019

  1. $SOLO. Rejected $5 so it got out for a 51c loss.
  2. $NTNX. Sold on the same candle due to a double top. I may change it to ignore the entry candle since that is not enough time to determine an exit.

One it did not trade was $SCON due to the scan price limit I have set. The exit indicators I have seem to work pretty well.

03/22/2019
Big sell off today and it’s not watching many stocks so I doubt there will be a trade.

No trades.

This week has been great. Couple bugs but all the trades worked to a certain degree. $NTNX was perfect.

03/25/2019

  1. $DSW. Nice.

03/26/2019

  1. $DCAR. Almost instant dump. 200 EMA resistance it looks like.

I’m starting to wonder if flags don’t work that well on low floats. $DCAR doesn’t even have a float on IEX because of so many reverse splits. I may add a “0” check just to filter more junk. The 200 EMA check should have worked but it was off by like 2c, so I’ll also check the last candle and not just the high of day.

03/27/2019
Pretty slow so no trades.

I’ve been adding new features to my trading app when the market is closed. I’ve added things like supporting different timeframes which is useful if a strategy works better on something other than the 5m. I’ve also started working on another strategy that shorts into whole/half dollar resistance when it’s super extended. I noticed a lot of stocks top at those levels so might as well see if I can write a strategy for it. It seems promising but I won’t know until I test it during market hours.

03/28/2019
Slow again.

  1. $KNX. Stopped out break even due to a half dollar top.

No short trades on the new strategy. I actually decided to rewrite it to simplify things a bit.

03/29/2019

  1. $HTHT. Decent setup but the prior candle dumped before making a new high on the next one. It sold for a small loss.
  2. $VKTX. Got a small move before dumping.
  3. $AMRN. Perfect setup and nearly top ticked the exit.

These next ones are the whole/half dollar shorts.

  1. $WDC. Instantly stopped out.
  2. $TGTX. Off a little bit before getting a pullback.
  3. $WTW. Absolutely flawless. Top ticked the whole number at 21 and caught most of the dip. This trade made up the losses of the other shorts and more.

The ones that did not work seem to be from half dollars which is less significant resistance than a whole number. I’ll have to wait for more trades to see if I should only short whole numbers or not.

Weekend

This weekend I worked on a few things related to the short strategy.

  • Half dollars definitely seem inconsistent when it comes to resistance (at least from my limited sample size). I still want to trade them to get more data.
  • Looking at daily resistance that coincides with a whole number top and it being extended intraday seems to yield better results. $WTW fits that critera perfectly.
  • I went back and looked at $AMD which has been topping at $27.00 on the 25th and 26th at the open. This coincides with daily resistance from the 20th.

It’s still a relatively simple algo that has the potential for large gains. Have to see what happens on Monday.

Update 9



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.

Trade Review - February 2019

February was pretty slow and I decided to paper trade for almost all of it so I could work on the algo some more. Small caps were so incredibly dead that it was rarely watching more than 15 stocks by 10:30 AM. I decided to increase the market cap from 1B up to 10B and eventually 15B just to see what it would trade.

A lot more trades were made due to this and I found a few problems.

  1. Low volatility stocks were being traded even though the ATR was good on all the candles. I added a percent ATR filter which seems to have helped.
  2. Risk/reward was poor on many setups so I added a R/R filter based on the stop and profit target. This actually filtered a lot of losing trades out. I decided on a 1.25:1 reward/risk. 2:1 or higher is ideal but sometimes you just can’t get that based on the stop and target. There are some where 1:1 is the best you can do and they work out perfectly.
  3. Since this algo only trades flags, the high candle needs to be above most of the previous 5-6 candles. I previously had checks in place for this but they were not functioning the way I wanted. I made a small change to skip the last 3 candles instead of 2 which seems to have worked. This is very difficult to test because I do not have many examples.
  4. Lastly, new exit indicators. I have double tops and topping candle checks, but those only cover certain scenarios. I added a new double top check that goes back multiple candles instead of only checking the last two. Another scenario is what happens when the stock misses the target by just a few pennies without blowing through it. It should probably sell it, right? That happened on $ZSAN on the last day of February (although it was not traded due to the bad R/R).



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.