Tag Archives: trading

Word-cloud-for-post-on-large-price-moves

Thoughts on the best BTC price moves

As the great and powerful Satoshi Nakamoto once said, “If you don’t believe me or don’t get it, I don’t have time to try to convince you, sorry.”

For a while I have used a piece of code that started as back-testing code and forked it to produce output whenever BTC-USD makes a 2 standard deviation move in price up or down. Basically I manually adjusted the threshold that is normally a fluid value in backtesting to a fixed value, so that 95% of the time a U for Up, or D for Down move is not recorded, It’s counted as O, which means nothing interesting happened and is not printed. CRON runs this hourly and the machine responsible for trading runs 24/7 and collects prices, since August 28,2018. It even plays a sound when one of these outlier moves occurs.

Here are a few lines from the end of the output….

2024-01-03 16:00:02.618000       63874 42197.47 43004.35 U 2 1.02
2024-01-03 19:00:03.434000       63877 42923.71 42269.13 D 2 0.98
O: 43795  95.0%
D: 1165  2.5%
U: 1148  2.5%

The top two lines have a time stamp followed by a tick count, this is where it is in the data set, in order, adding 1 per hour. Next are the two prices, the starting and ending prices, U or D, signalling which way it just went. The next number shows how many hours have elapsed since the last radical move followed by the scale of the move. This is a rounded number that shows what number would be required to multiply the first price to get the current price, how big a move in other words.

2 Standard Deviations for Bitcoin

Daily

I recently adjusted the calibration threshold as BTC is settling down into less radical swings as time goes on. Currently it is….

THRESHOLD = 0.01459 # 0.0156

…which means on an hourly basis a 1.459% move registers as a 2 standard deviation move. It was 1.56% earlier this year, so volatility is trending down over time.

Can that be tradable, not likely as fees and slippage would most likely eat up the 1.459%, granted some higher swings do occur and I have pondered this. What is you bought all the big down moves and sold on the big up moves. Sounds good in theory and would most likely only work in an up market or else, you just wind up buying at bad entries and ‘bag hold’ too much at a loss until the next bull run.

Weekly

I got the idea to look at a daily and weekly time frame. Weekly is such a short output that I will paste it here….

Start of Data: 2018-09-05
Lines of input data: 279
Lines to process: 279
2018-11-21 05:00:11.243000       17809 6268.44 4452.68 D 10 0.71
2019-04-03 04:00:15.519000       17828 3976.88 5050.01 U 18 1.27
2019-05-15 04:00:15.266000       17834 5782.6 8063.78 U 5 1.39
2019-06-26 04:00:16.011000       17840 9139.01 12228.39 U 5 1.34
2019-07-17 04:00:14.972000       17843 12983.74 9411.06 D 2 0.72
2020-03-15 04:00:05.033000       17878 8749.01 5168.75 D 34 0.59
2020-08-02 04:00:06.489000       17898 9686.6 12000.0 U 19 1.24
2020-12-20 05:00:12.005000       17918 18865.0 23460.71 U 19 1.24
2021-01-03 05:00:14.866000       17920 26732.29 33231.68 U 1 1.24
2021-02-14 05:00:19.359000       17926 38365.06 47607.09 U 5 1.24
2021-03-14 05:00:09.349000       17930 49437.95 61191.88 U 3 1.24
2021-08-01 04:00:03.128000       17950 34192.29 42461.2 U 19 1.24
2022-06-19 04:00:02.056000       17996 27515.55 18282.06 D 45 0.66
2023-03-19 04:00:02.137000       18035 20598.23 27282.54 U 38 1.32
D: 4  1.4%
O: 264  95.0%
U: 10  3.6%

A few things to note:

  • There is asymmetry as the market has in general been rising since 2018, so there are only 4 ‘large’ down moves and 10 up. 1.4% weeks are up moves, 3.6% are down. The number after U and D is the weeks between moves.
  • Note the magnitude of the moves. They are truly massive. As the threshold is now 0.235.
  • Note that the 5 sequential up moves in a row 2020-2021 barely made in over the threshold at 1.24
  • Make note of the fact that Bitcoin is calming down over the years by looking at how many times per year it makes these epic moves.
  • Last but not least. I wonder if the what the linear regression of the prices would tell. Perhaps good targets for the future?
Large Weekly BTC Price Moves
Large Weekly BTC Price Moves

From now on, I will monitor this more carefully. As one can see, entry and exit although infrequent would have lead to stellar performance. I’ve been doing crypto TA and writing related code for almost 6 years now and it is still interesting that some new price relationships can be sussed out.

Looking ahead

It’s a guess buy based on the chart above it will be worth seeing if there is a pullback below the price of the blue linear regression termination, 37K-ish down to the termination of the D and E price lines 20598.23 27282.54. It will be interesting to followup on this.

Daily

For daily the THRESHOLD = 0.076, so that means greater that 7.6% moves are counted. Below I have pasted in the 2022 to 2023 results. 2022 being terrible and 2023 awesome. I let the reader ponder the readability of these price moves.

 

2022-02-05 05:00:03.175000       19053 37326.16 41505.25 U 62 1.11
2022-02-24 05:00:04.472000       19072 38042.82 35122.81 D 18 0.92
2022-02-25 05:00:04.643000       19073 35122.81 38740.11 U 0 1.1
2022-03-01 05:00:06.659000       19077 37830.34 43388.77 U 3 1.15
2022-03-09 05:00:02.706000       19085 38554.62 41656.28 U 7 1.08
2022-05-06 04:00:02.780000       19143 39727.55 36446.18 D 57 0.92
2022-05-10 04:00:02.150000       19147 33556.09 30678.51 D 3 0.91
2022-05-12 04:00:02.124000       19149 31191.22 28234.93 D 1 0.91
2022-05-13 04:00:02.622000       19150 28234.93 30523.85 U 0 1.08
2022-06-14 04:00:02.293000       19182 25483.35 22074.01 D 31 0.87
2022-06-17 04:00:02.808000       19185 22182.06 20359.29 D 2 0.92
2022-06-19 04:00:02.056000       19187 20424.2 18282.06 D 1 0.9
2022-06-20 04:00:02.514000       19188 18282.06 19961.12 U 0 1.09
2022-07-08 04:00:02.559000       19206 20465.35 22125.65 U 17 1.08
2022-07-28 04:00:01.952000       19226 21076.25 23137.12 U 19 1.1
2022-09-14 04:00:02.511000       19274 22235.95 20324.97 D 47 0.91
2022-11-10 05:00:02.217000       19331 18242.1 16433.61 D 56 0.9
2023-01-14 05:00:02.777000       19396 18820.73 20901.76 U 64 1.11
2023-01-21 05:00:02.053000       19403 20991.31 22602.95 U 6 1.08
2023-02-16 05:00:02.079000       19429 22092.46 24634.33 U 25 1.12
2023-03-10 05:00:02.124000       19451 21737.7 19877.69 D 21 0.91
2023-03-13 04:00:01.980000       19454 20598.23 22326.45 U 2 1.08
2023-03-14 04:00:02.715000       19455 22326.45 24517.05 U 0 1.1
2023-08-18 04:00:02.811000       19612 28619.6 26395.38 D 156 0.92
2023-10-24 03:00:02.742000       19679 30389.89 34553.97 U 66 1.14
D: 46  2.4%
O: 1856  95.0%
U: 51  2.6%

 

Looking at the plot for daily and remember this does not mean the X axis is time, just moves, even though it does look similar to a price -vs- time chart. In this case both regression lines overlap 100%.

 

Large BTC Daily Price Moves
Large BTC Daily Price Moves

Looking ahead

This is a guess but looking at this I am inclined to think a pullback between the regression line termination at 40K and the termination of the D and E price lines at 30 and 35K would be something to keep and eye out for.

Alternative Daily Move Chart

Taking the geometric mean of the daily and weekly thresholds, the result is 0.133. This produces using a daily tick an output that has as many large price moves as the weekly chart and can be seen as an alternative while slightly different, lines up similarly on the chart. The moves are roughly 3 standard deviation moves in this case.

Start of Data: 2018-08-30
Lines of input data: 1955
Lines to process: 1955
2018-11-20 05:00:17.949000       17880 5495.99 4641.55 D 81 0.84
2018-11-25 05:00:13.877000       17885 4301.01 3632.02 D 4 0.84
2019-04-03 04:00:15.519000       18014 4177.0 5050.01 U 128 1.21
2019-05-14 04:00:15.992000       18055 7016.99 7963.14 U 40 1.13
2019-06-28 04:00:15.313000       18100 12821.64 11110.99 D 44 0.87
2019-10-26 04:00:17.489000       18220 7455.01 9599.17 U 119 1.29
2020-03-13 04:00:04.431000       18359 7659.09 5385.44 D 138 0.7
2020-03-20 04:00:04.240000       18366 5301.62 6163.32 U 6 1.16
2020-04-30 04:00:04.743000       18407 7821.73 9291.9 U 40 1.19
2021-01-06 05:00:08.853000       18658 30880.51 35456.93 U 250 1.15
2021-02-09 05:00:09.512000       18692 38618.01 46888.08 U 33 1.21
2022-03-01 05:00:06.659000       19077 37830.34 43388.77 U 384 1.15
2022-06-14 04:00:02.293000       19182 25483.35 22074.01 D 104 0.87
2023-10-24 03:00:02.742000       19679 30389.89 34553.97 U 496 1.14
U: 9  0.5%
O: 1940  99.3%
D: 5  0.3%

 

Large-BTC-Daily-Moves-w-Linear-Regression-0.133
Large-BTC-Daily-Moves-w-Linear-Regression-0.133

 

Code

Code is on Github, it is quite a hack as it was made from pieces of other backtest code and production code that has not been cleaned or refactored.

https://github.com/erickclasen/cbpro-cli-tools/blob/main/uod.py

Misato Katsuragi

Kelly Criterion

If money is your bread then nothing else matters.

The Kelly Criterion is something anyone who trades, invests or even gambles must know. I have a brief summary below and some additional resources at the end of the summary.

There is also a great book devoted to this topic, Fortune’s Formula by William Poundstone, a must have book for any serious investor.

The Kelly Criterion, also known as the Kelly strategy, Kelly formula, or Kelly bet, is a mathematical formula designed to help people determine the optimal size of a series of bets. It’s named after John L. Kelly, Jr., who introduced the concept in a 1956 paper titled “A New Interpretation of Information Rate.”

The Kelly Criterion is commonly used in gambling, investing, and other areas where decisions involve uncertainty and risk. The goal of the Kelly Criterion is to maximize the long-term growth of capital by finding the optimal fraction of capital to invest in each opportunity.

The basic formula for the Kelly Criterion is:

Kelly-Critierion
Kelly-Critierion

The formula tells you what percentage of your current capital should be invested in a particular opportunity, given your assessment of the probability of success and the odds being offered.

It’s important to note a couple of things about the Kelly Criterion:

1. Risk of Ruin: The Kelly Criterion can be aggressive. Betting too much of your capital, even with a positive expectation, can lead to significant losses. The criterion doesn’t consider the risk of ruin, which is the risk of losing your entire capital.

2. Estimates are Crucial: The accuracy of the criterion depends heavily on the accuracy of your probability estimates. If your estimates are inaccurate, the strategy might not perform well.

3. Logarithmic Utility: The formula assumes logarithmic utility, meaning that the investor’s goal is to maximize the expected logarithm of wealth. This utility function helps to balance between risk and reward.

To use the Kelly Criterion, you would apply the formula to each opportunity, and the resulting fraction represents the proportion of your current capital that you should invest.

Keep in mind that many variations and adaptations of the Kelly Criterion exist to address specific situations and concerns. It’s a tool that requires careful consideration and understanding of the underlying assumptions and risks.

 

To learn more, see these resources

https://www3.cs.stonybrook.edu/~skiena/691/2007/lectures/Kelly.pdf

http://r6.ca/blog/20070816T193609Z.html

https://www.economist.com/media/globalexecutive/fortunes_formula_e.pdf

https://towardsdatascience.com/python-risk-management-kelly-criterion-526e8fb6d6fd

sellbuy-o-meter

We are governed by laws, not by laws, but by people. Government is by people.

We all need a sellbuy-o-meter

  • Get the timing just right every time.

  • No more missing the tops and bottoms.

  • Maximize profits right from the start.

  • Be a winner every time.

Hey there, it’s your favorite lawyer, Saul Goodman, and I’ve got some advice for all you traders out there. You need a sellbuy-o-meter, plain and simple. This little gadget tells you when to buy and sell, so you can get the timing just right every time. No more missing the tops and bottoms of the market, my friends. You’ll be maximizing your profits right from the start and be a winner every time.

With this sellbuy-o-meter, who needs stop losses? You’ll be making maximum gains with no losses. Your eyes will thank you, too, because there’ll be no more chart reading voodoo and magic. Put away your lucky charms and get ready to use some 10x or more leverage.

And let me tell you, you’ll sleep like a baby at night knowing you’ll never get a trade wrong. Risk management will only entail replacing the batteries in the meter. (Batteries not included, unfortunately.)

So what are you waiting for? Order your sellbuy-o-meter today and get a free spouse-o-meter! This little beauty tells you what mood your significant other is in – mad, sad, or glad – we’ve got them all covered. Don’t hesitate – order now!

sellbuy-o-meter
sellbuy-o-meter

Sometimes these Clickbait con-tra-prenur social media ads just get under my skin. It feels a little bit like I am being sold a scam by Slippin Jimmy a.k.a. Saul Goodman.

Daytrading: Response to Clickbait Ad

I responded to an clickbait ad on social media with the following.

Daytrading, I would not recommend it for newbies. It’s not for everyone and it’s not something to jump into blindly. With trading in general, start very small, like 1% of your net worth, learn and then build up your position sizes slowly as a reward for success. Other than your ‘play’ money, while learning just buy and hold with the bulk of you invest able $. Daytrading is something to do only when a level of mastery of trading on higher time frames using small money. Trading will cost you money and time until you gain experience, these are the facts, plain and simple. It is part skill, part art, timing and luck. The shorter the time frame, the higher the market noise relative to the signal that you are trying to capture and make trades on, this combined with fees and slippage makes daytrading difficult to begin with (Super quick trades, noise, fees and slippage will eat your $ up.). Is it possible to make money daytrading ,yes, but you will be strapped to a computer to do it, is that something that will be enjoyable in the long run, seriously think about it. Do you really want to sit in front of the computer watching 1,5,15m candles with a finger hovering on the mouse all day. That’s for machines to excel at, really, that’s how the big firms can even make money at all, besides low fees and getting paid for order flow. Being able to code algorithms to trade for you via an API, then you just have to babysit the system to make sure it is working right, less work than sitting in front of charts on PC all day, requires math,coding and fintech type skill however. That might be a path to daytrading for the committed in the long run. If none of the preceding jargon makes sense, time to study up. Knowledge of probabilities and statistics go a long way, I had to relearn quite a bit of this, yeah it sucked a bit, should have paid more attention in those classes. Understand what the Kelly Criterion is, “Fortune’s Formula” the book, covers it. That way you can get a grasp on risk management and don’t blow up your account. A so-so trader with good risk management will make money. A good trader with poor risk management will fail, the account will go up and down, maybe most and more down,boom and bust and potentially fully bust. Works by Ed Thorp, Elder Alexander, Perry Kaufmann, John Murphy are a good foundation to understand trading. Reminiscences of a Stock Operator Book by Edwin Lefèvre Zen, they hand this out at Goldman when you start there. Get to understand the Psychology of trading and money (Morgan Housel), the ups and downs are rough. If you don’t get a grasp on how it impacts you emotionally it will be painful in the gut. Position sizes, watch those, you want to be able to sleep at night, once again we are talking risk management. If you’ve studied the foundations and it still doesn’t make sense keep studying, it might keep sinking in while you practice trade with small money and put a chunk in buy+hold. As you gain experience some of the material you study will start to make more sense, time to reread. If after all this, it still doesn’t work, find a mentor who will help you, someone who has “made it” and is willing to give back to help the next generation. Ideally buddy up with someone from the start, find a club. There is too much hype and charlatanism out there waiting to mislead and take advantage of newbies, pushing a lot of nonsense.

Another Similar Response to an Ad on how to figure out Bull/Bear conditions

You can tell if it is bullish or bearish in a few minutes, why it is bullish or bearish, well that can take much longer to figure out. But, you can learn this yourself or find a mentor. Hang around the right people and you will learn, find a mentor who will help you, someone who has “made it” and is willing to give back to help the next generation. Ideally buddy up with someone from the start, find a club. There is too much hype and charlatanism out there waiting to mislead and take advantage of newbies, pushing a lot of nonsense………But for now, practical wise, an example of figuring out bull/bear bias of an asset. Ichimoku chart is good to use and learn, on it, is the Tenken above the Kijun? Is the price above both of those? Is the price above the cloud? Also is the asset in a golden cross 50 day MA > 200 day MA. Then look at the macro picture, over all market up? Is the sector up? These are Bull signals, the more the better. Better yet, figure out your own method and come up with a checklist. Also, price can always change on a whim, you can’t predict it. Use risk mgmt to mitigate against loss, tomorrow there could be a banking crisis, political crisis, war, flash crash, protect against those as well as you can.

AU-USD Prices to 3/2021

Opinions of Trading

There is too much hype an charlatanism out there waiting to mislead and take advantage of newbies, pushing a lot of nonsense. This is a quick post, stream of conciousness with some of my personal opinions.
Myself, I use several trading strategies, from mean reversion and gap buying algos running on a 5m tick tuned using genetic differential evolution, mid range day to week algos, trend and mean reverting, to manual trades that take weeks and to long term holds in a custom index fund that get added to over time. Personally for manual trading/investing if I had to choose one technique out of them all, Ichimoku would be the one. Daily/Weekly for most assets, gold and silver, Weekly/Monthly.

Trading and Investing in General

 It’s not for everyone and it’s not something to jump into blindly. Start very small, like 1% of your net worth, learn and then build up your position sizes slowly as a reward for success. Other than your ‘play’ money, while learning just buy and hold with the bulk of you invest able $. There is a lot more to it than charts and excitement when TSLA and DOGE climb. It’s more about psychology (See Elder Alexander and Morgan Housel)and risk management than anything. Forget about get rich quick and fast money, let it ride out for the long term. Day trading is not the place to start either. It is much to0 confusing for a beginner as to read signal (trend) in the noise of random price movements at low timeframes. Myself, I leave the low time frame stuff to algos, and mostly mean reversion works better than trend following with high noise at low time frames. To do algos, you need to know/learn code, well I might add, not just wing it. It’s not for everyone, depends on your skills and motivation to learn, math, physics, CS, engineering helps here. Briefly, just look at the edge cases, buy and hold and super quick trades. Super quick trades, noise, fees and slippage will eat your $ up. Plus, do you really want to sit in front of the computer watching 1,5,15m candles with a finger hovering on the mouse all day. That’s for machines to excel at, really. Buy and hold works and is super low maintenance, but in my opinion it can be easily improved on with a few small considerations. Use some basic moving averages, long ones, 1yr, 2, what ever makes sense on the major high and low cycles, then pick a multiple of this value not the time of the average, curve fit it to past data that is reasonable, DCA (Dollar Cost Average) in below the long base average, DCA out above the multiplier, like 5X the 730 day avg for BTC, for example. This helps get some more bang out of a plain buy and hold. The timing depends on how fast the asset moves. BTC, shorter cycles from peaks at about 3-5 years apart, think 2013,2018,2021 a 2 year MA works well and for the multiplier, look at the lows and highs and fit to them. Stocks, using an index like SPY, think of the last low, the real low, on March 9,2009, moves slower than BTC. But averages can be fit to the lows for a good DCA in. Gold, slower too. Look at an asset, see how long it took to 10x on a buy and hold hypothetically, that gives you a sense of the speed of assent. BTC does it in less than a year at times. Silver, just because, I know it off the top of my head was around $3 around 2003 and in 2011 it 10x’s that, a 1964 quarter was almost $0.25 in silver weight then, now it’s worth $4+ in Silver, so that’s it’s rate of change. Went on a bit of a tangent, hope this is helpful for someone.

Intro to Cryprocurrency

This post is a bit of a quick rant on the basics of cryptocurrencies (crypto) and is just my opinions and not any advice on investing. It started as a response to someone that was interested in learning a bit of the basics of cryptocurrency. Then I got on a roll and covered a bit of ground. It does not contain many references to sources as I was working from memory of information that I have seen or heard.

Pros and Cons

One of the cons with cryptocurrencies is wading through the charlatans and hype out there. Scammers too, malware that tries to copy your crypto addresses as you cut and paste them, always visually confirm and never leak your private addresses in an unsecured environment, they are your money. hype and nonsense out there also applies to trading, investing and mining it. Lots of pros to it. But, it all really depends what you want to do with it. The options typically center around trading,investing,mining it and using it as a payment method. I’ll work through the list a bit and build my case for crypto as I move along. Mining a coin such as ETH ,is not profitable for most people at the moment, Currently electricity and equipment costs factor into this heavily. However this may change in the future as ETH will be moved from a proof of work to a proof of stake model (a bit much to explain in this intro, but if you go to the site name for the creator of Bitcoin, Nakamoto.com, there is a whole intro to cryptocurrency series of posts there), with ETH 2.0, along with other changes. Using it as a payment method is getting simpler every day, there are numerous apps for it, Cash App and Coinbase for example.  PayPal and Venmo will be integrating crypto purchases into there systems.

Fundamentals

What is going on that may cause prices to rise

People in Europe that work on the underpinnings of the banking system that allows money to move around under the hood, kind of like our ACH system here in the US are working with the folks who developed the crypto called LINK. This has leaked out, I saw the presentation where the guy giving it slipped and said the name that LINK uses in it’s code instead of the secret project name that they were using to cover up LINK’s involvement. These projects are typically secret with NDA’s and all but, human error and a slip of the tongue can happen. The US Gov’t, Treasury Dept. has hired the person that developed the stable coin called USDC for Coinbase. He worked for a bank prior to Coinbase, the name I can’t remember, but there is a picture of him with 2 other co workers that now work in the Treasury Dept. so he was most likely hired because he was the lead in developing the USDC stable coin for Coinbase. A stable coin is a coin that attempts to stay in lockstep with a fiat currency. USDC is always $1, some others ary a little bit around $1, like a range a few pennies up and down at most. Examples are Tether and DAI. On top the Gov’t reserach into an electronic coin, there was initial language in the draft for the stimulus package that was removed that reference disbursing payments using electronic coins developed by the US Gov’t. I saw copies of this, it was interesting to see a reference to an electronic coin in a gov’t doc. Also, large banks are starting to work to become custodians for crypto currencies as well, they are entering into agreements with exchanges to be the custodians of large amount of crypto. BTC futures are traded on the Chicago exchange (Chicago Mercantile Exchange), something the big boys in the investment banks are interested in. There is something called BAKKT that the investment banks are working on, I forgot the details but, it relates to cryptocurrencies Why does this matter? This is all a big pro. Because governments adopting blockchain technology, Investment banks are starting to use crypto as an investment vehicle and considering being custodians of it and integrating blockchain tech into transactions. All of this validates it’s existence, which means only more growth in the future as people (investors really and end users eventually) realize it is not some kind of fad and a toy for tech hobbyists. Remember the curve of other tech. The first home computers were also “toys” and now we can’t live without (several of them, think phones too) them, the same will happen with crypto currencies in time. As far as investing in it. A big pro is that it is a new asset class in the world. Every time a new asset class comes into being it makes for a great investment opportunity as new asset classes don’t some along often.

Cryptocurrencies as Technology

Trading and Investing

Cryptocurrencies behave a lot like a new technology in that there is an exponential growth curve which is reflected in the price. ETH could be bought for around $10 in 2016-17 and today it is worth over $300 with recent highs above $400. Weekly time-frame Ichimoku chart has a target at $750 within the next year most likely. Trading and investing are similar but, two different animals. A con with trading in general that does not occur as easy with investing is that it is easy to lose money trading for a lot of reasons, as a beginner. Most of them have less to do with proficiency and the mechanics of trading and more to do with emotional factors, especially how we view money itself. The market it a brutal but honest teacher at times and it will teach you how to look at your belief system. And, it is always your fault when you lose, the market never lies, only we can lie to ourselves. In the beginning I wish I would have spent a bit more time learning this versus spending most of my allotted learning time on technical analysis. I have found quite a few good time tested resources on the trading topic if you are interested. Always start with a few hundred $ and work up slowly until the charts stop looking like just a bunch of lines and start to intuitively make sense and your heart no longer drops every time the prices go red. It’s as if you have to develop a Zen or Taoist attitude to the market. Start with something really simple for a trading rule and stick to it. The more simple and boring the better until you get experience. And, on a longer time frame, daily and weekly charts, not less than hourly charts to start. In the limit as time –> 0 the charts become just noise which can cause confusion at best. Crypto has much more volatility than many other asset classes, so more noise there too. Especially the small cap coins, up 100% one day, down the next and as usual it takes double the gain to make up for a loss of half, so losses mount fast in downward price shocks. BTC and ETH, being large cap are less volatile than the rest, about 3000 of them, some of which are a joke (literally DOGE and Siraj coin are memes) and really have no future at all, Big pro. Investing for the long haul is one of the easiest easy options to start that can even be combined with trading/active investing. One of the best methods to invest in an asset with exponential growth is to accumulate the asset when the price is below the 1 year to 2 year average price and then distribute out at a price that is a multiple (2,3,5) of the 1-2 year moving average. Golden Ratio Multiplier Chart. This is an almost foolproof way to actively invest and could be used to dollar cost average in at the best times. Feel free to reach out to me for any more and research. I would highly recommend listening the Lex Fridman podcast where he interviews Vitalik Buterin the co-creator of ETH to get a flavor of the mind of who is behind it.

BTC Gains

BTC versus Stock Bull Run

Stock Bull Run
Stock Bull Run to Bust, 2009-2020

This post is an addition to the series on DMAC algorithm trading, which is simple algo trading example. I was wondering now that the S&P500 and etc, legacy market has dropped out of it’s long bull run, how would Bitcoin gains compare against the stock market?

First Post in Series to Learn More Background

Code to run this model on Github

BTC Buy and Hold -v- S&P 500 Buy and Hold

The plan: Comparing  Bitcoin (BTC) gains from January 1,2010 to December 31,2019 against the bottom for stocks on March 9, 2009 to Feb 19,2020, the 400% bull run for the S&P 500. But, for some reason the Yahoo data for Bitcoin is only going back to 2014-09-16. So we are basically getting a bit short changed here on BTC and giving the S&P a long head start for nearly 5 years. (I am sure at one point in the past, I think this used to work and go back all the way to 2010 but Yahoo must have cutoff the data since I first tried this code.)

So with 5 years head start for S&P

S&P500 4x gain across history shown in the above chart 03-09-2009 to 2-19-2020

BTC 16.96x gain from 9-16-2014 to 2-19-2020

Now for a true side by side comparison

S&P 500 on 9-16-2014 closed at 1998.98

S&P 500 on 2-19-2020 closed at 3386.15

S&P 500 gain 1.69x from 9-16-2014 to 2-19-2020

So Bitcoin beats the S&P using by and hold across the same time frame by 10x.

Buy and Hold -v- DMAC Algo Trading on BTC

OK, now what about BTC HODL (Buy and Hold) gains versus optimized DMAC algorithm trading from 9-16-2014 to 2-19-2020?

HODL Gains: 16.96393901373665

Algo gains for a 1 day short and 4 day long average. This is wicked tight and it will trade like mad, so in real life, the transaction fees and slippage would eat away at this number after 10 years.

Short AVG,Long AVG,Best Bank 1 4 2244962.564086914 which is 22.4x

which is 22.4x gains. But, with fees/slippage  and HODL at ~17x , HODL is really great. Beats the 4x or 1.69x depending on the time frame of the S&P 500!

It could do better

This is a simple algorithm, one of the simplest ones that can be thought of. Also, remember that the algorithm only tuned once across the entire time period. If the time  period was cut up into smaller periods and the algorithm learned the market as it changed over time instead of trying to get a best fit across 5 years it would have produced more gains. The example the initial post which has it trade from Jan 1 to Dec 31 of 2019 shows in making 900K alone in one year. So an algorithm that could in theory re-optimize periodically as the market conditions change would easily beat the results of this simple algorithm. The best thing that I can think of would be a machine learning algorithm that would use differential evolution to change the parameters as time goes on. It would learn on an ensemble of random sections of random lengths of data from the past and tune the algorithm’s parameters based on learning from the data ensembles. That is just one way that comes to mind.

But, at the end of the day this is just an example. It is not always possible to predict future results from past data. It is also well known and Covid-19, The Great Recession and Black Monday in 1987 serve as examples, there will be price shocks that can upend any model in practice. The statistics of price action do not fall neatly under a bell curve but have fat tails that lead to excursions far away from the mean on occasion. One only has to look to history for this lesson and one example is the firm Long-Term Capital Management (LTCM) led by a brilliant team of folks including Nobel prize winners Merton and Scholes, two out of the men that invented the Black-Scholes option pricing formula. Fischer Black, the other man was not alive at the time that the prize was awarded. Some credit for  the formula rests with Ed Thorp as well, at least a way in the backstory. Ed Thorp had basically the same kind of formula running on convertible bonds, not a far jump to options pricing. This is all outlined in the great book The Quants by Scott Patterson. Quants was one of the seeds that led me to pursue trading, specifically algorithmic trading a few years after I read it.

Lessons To Be Learned

So there were brilliant guys were at the heart of LTCM but, due to high leverage and a divergence of their models from reality when the Russian government defaulted on their debt, the firm crashed and burned financially. It happened fast as they and others holding similar positions in the market all simultaneously unwound those positions. LTCM was stuck holding a lot of positions trying to offload into a market without many buyers, low liquidity, and the worst part of it, being leveraged heavily 30-40:1 was the real problem. They were effectively running backwards selling off, what normally one would not want to be forced to sell off, being highly leveraged it quickly ran out of margin and went effectively bankrupt. The pieces of LTCM were bought up by 13 banks and this averted a disaster that  could have been equal to 2008 if the banks had not carved up the LTCM carcass among themselves. It could have easily had a domino effect on the rest of the banks and the global market much like what happened in 2008. LTCM as brilliant as it began, ended as a good lesson for the future, if only heeded and rocked the markets for a while and the shock cascaded. Then the lesson seems to get lost in general, although I imagine some took it to heart, in general  history repeated itself about a decade later in terms of the next financial crisis which was the same thing only an order of magnitude larger. 2008 was not containable by some short term heroics between the Fed and 13 banks as in the case of LTCM.

https://www.pbs.org/wgbh/nova/transcripts/2704stockmarket.html

https://www.pbs.org/wgbh/nova/stockmarket/

https://www.pbs.org/wgbh/pages/frontline/warning/themes/ltcm.html

 

BTC Algo Traded Using DMAC algo
BTC Algo Traded Using DMAC algo.
Bitcoin Buy and Hold: How much was made?
Bitcoin Buy and Hold: How much $ was made? 100K to 2.2M
Maximum draw-down for the algo for the time period.
Maximum draw-down for the algo for the time period.

Raw Dump

(base) erick@OptiPlex-790 ~/python/simple-strat $ python simple-strat-loop-backtest-2010-2019.py
Get Data
Run Model
Short AVG,Long AVG,Best Bank 1 1 100000.0
Short AVG,Long AVG,Best Bank 1 2 1495120.7946777344
Short AVG,Long AVG,Best Bank 1 3 1845316.8991088867
Short AVG,Long AVG,Best Bank 1 4 2244962.564086914
 signal short_mavg long_mavg positions
Date 
2014-09-16 0.0 457.334015 457.334015 NaN
2014-09-17 0.0 424.440002 440.887009 0.0
2014-09-18 0.0 394.795990 425.523336 0.0
2014-09-19 0.0 408.903992 421.368500 0.0
2014-09-20 0.0 398.821014 406.740250 0.0
2014-09-21 1.0 402.152008 401.168251 1.0
2014-09-22 1.0 435.790985 411.417000 0.0
2014-09-23 1.0 423.204987 414.992249 0.0
2014-09-24 0.0 411.574005 418.180496 -1.0
2014-09-25 0.0 404.424988 418.748741 0.0
2014-09-26 0.0 399.519989 409.680992 0.0
2014-09-27 0.0 377.181000 398.174995 0.0
2014-09-28 0.0 375.467010 389.148247 0.0
2014-09-29 1.0 386.944000 384.778000 1.0
2014-09-30 1.0 383.614990 380.801750 0.0
2014-10-01 0.0 375.071991 380.274498 -1.0
2014-10-02 0.0 359.511993 376.285744 0.0
2014-10-03 0.0 328.865997 361.766243 0.0
2014-10-04 0.0 320.510010 345.989998 0.0
2014-10-05 0.0 330.079010 334.741753 0.0
2014-10-06 1.0 336.187012 328.910507 1.0
2014-10-07 1.0 352.940002 334.929008 0.0
2014-10-08 1.0 365.026001 346.058006 0.0
2014-10-09 1.0 361.562012 353.928757 0.0
2014-10-10 1.0 362.299011 360.456757 0.0
2014-10-11 1.0 378.549011 366.859009 0.0
2014-10-12 1.0 390.414001 373.206009 0.0
2014-10-13 1.0 400.869995 383.033005 0.0
2014-10-14 1.0 394.773010 391.151505 0.0
2014-10-15 0.0 382.556000 392.153252 -1.0
... ... ... ... ...
2019-12-03 0.0 7320.145508 7409.014038 0.0
2019-12-04 0.0 7252.034668 7329.615234 0.0
2019-12-05 1.0 7448.307617 7335.619019 1.0
2019-12-06 1.0 7546.996582 7391.871094 0.0
2019-12-07 1.0 7556.237793 7450.894165 0.0
2019-12-08 1.0 7564.345215 7528.971802 0.0
2019-12-09 0.0 7400.899414 7517.119751 -1.0
2019-12-10 0.0 7278.119629 7449.900513 0.0
2019-12-11 0.0 7217.427246 7365.197876 0.0
2019-12-12 0.0 7243.134277 7284.895142 0.0
2019-12-13 1.0 7269.684570 7252.091431 1.0
2019-12-14 0.0 7124.673828 7213.729980 -1.0
2019-12-15 0.0 7152.301758 7197.448608 0.0
2019-12-16 0.0 6932.480469 7119.785156 0.0
2019-12-17 0.0 6640.515137 6962.492798 0.0
2019-12-18 1.0 7276.802734 7000.525024 1.0
2019-12-19 1.0 7202.844238 7013.160645 0.0
2019-12-20 1.0 7218.816406 7084.744629 0.0
2019-12-21 0.0 7191.158691 7222.405518 -1.0
2019-12-22 1.0 7511.588867 7281.102051 1.0
2019-12-23 1.0 7355.628418 7319.298096 0.0
2019-12-24 0.0 7322.532227 7345.227051 -1.0
2019-12-25 0.0 7275.155762 7366.226318 0.0
2019-12-26 0.0 7238.966797 7298.070801 0.0
2019-12-27 1.0 7290.088379 7281.685791 1.0
2019-12-28 1.0 7317.990234 7280.550293 0.0
2019-12-29 1.0 7422.652832 7317.424561 0.0
2019-12-30 0.0 7292.995117 7330.931641 -1.0
2019-12-31 0.0 7193.599121 7306.809326 0.0
2020-01-01 0.0 7200.174316 7277.355347 0.0

[1933 rows x 4 columns]
 BTC-USD holdings cash total returns
Date 
2014-09-16 0.0 0.0 100000.0 100000.0 NaN
2014-09-17 0.0 0.0 100000.0 100000.0 0.0
2014-09-18 0.0 0.0 100000.0 100000.0 0.0
2014-09-19 0.0 0.0 100000.0 100000.0 0.0
2014-09-20 0.0 0.0 100000.0 100000.0 0.0
 BTC-USD holdings cash total returns
Date 
2019-12-28 731799.023438 731799.023438 1.515663e+06 2.247462e+06 0.001243
2019-12-29 742265.283203 742265.283203 1.515663e+06 2.257928e+06 0.004657
2019-12-30 0.000000 0.000000 2.244963e+06 2.244963e+06 -0.005742
2019-12-31 0.000000 0.000000 2.244963e+06 2.244963e+06 0.000000
2020-01-01 0.000000 0.000000 2.244963e+06 2.244963e+06 0.000000
Portfolio Plot
Sharpe Ratio 1.5767602439593071
Compound Annual Growth Rate (CAGR) 0.7067353770154898
HODL Gains: 16.96393901373665

 

 

 

Bull market 2009 to 2020

Trading Resources Books

Speculation in stocks will never disappear. It isn’t desirable that it should. It cannot be checked by warnings as to its dangers. You cannot prevent people from guessing wrong no matter how able or how experienced they may be. Carefully laid plans will miscarry because the unexpected and even the unexpectable will happen. Disaster may come from a convulsion of nature or from the weather, from your own greed or from some man’s vanity; from fear or from uncontrolled hope. – Reminiscences of a Stock Operator


This post is a trading resource dump on books for trading 

I have some good books in the list. The ones that cover the psychological aspects of trading are worth the time to read if you have gotten past the basics of trading. It helps if you have traded a little at least to have some hands on experience with it. Best to start out with a few hundred dollars and build up the account as you get the hang of trading. Adding to the account slowly. I wish I had read these books  in the beginning, just when I was trying the first half dozen trades, at the same time that I was learning about the technical aspects of trading.

 

Subject: Road less traveled M. Scott Peck

https://www.apnamba.com/Ebooks-pdf/The%20Road%20Less%20Traveled.pdf

The first section on discipline is a good read for the psychology of trading. Think discipline in terms of trading.


Subject: Technical Analysis (TA) of financial markets John Murphy

Classic TA book. This along with Perry J. Kaufman’s book New Trading Systems and Methods will be good references for the nuts and bolts of trading.

http://194.145.209.129/bk/wp-content/uploads/2020/02/download.php?file=Technical-Analysis-of-the-Financial-Markets-8freebooks.net_.pdf

Subject: Another TA Book, Open Source

This book is a good reference book. It compiles a lot of information that is in the public domain, mostly via Wikipedia in one place. At the end of each chapter there are good notes, references and further reading. It is good to have this on hand when you want to look something up quick or for beginners to get an overview of technical analysis.

http://www.mrao.cam.ac.uk/~mph/Technical_Analysis.pdf

In the Markets: Confessions of a Samurai Trader Edward Alan Toppel

Worth a read, especially for anyone that has been exposed to Asian culture. It still makes sense if you’re not familiar with the culture but, if you are it’s going to be a deeper read.

Confessions of a Samurai Trader Ebook https://www.forexfactory.com/attachment.php/2566801?attachmentid=2566801&d=1510983772

Trading for a living by Elder Alexander

Very good, Elder Alexander is a Psychologist turned trader. He is also the inventor of the Triple Screen Trading System, which is outlined in the book.

This is in download PDF http://www.saham-indonesia.com/Ebooks/Technical%20Analysis/Elder%20Alexander%20-%20Trading%20For%20A%20Living.pdf

 Reminiscences of a Stock Operator Book by Edwin Lefèvre Zen

There is nothing like losing all you have in the world for teaching you what not to do. And when you know what not to do in order not to lose money, you begin to learn what to do in order to win. Did you get that? You begin to learn!

Very good, a must read! This book is supposedly handed out to new employees at Goldman Sachs to read as a first assignment. I can see why, it really is an eyeopener. It is a book I wished that I had read right in the beginning of starting to consider trading myself.

https://ia803009.us.archive.org/4/items/JesseLivermoreReminiscencesOfAStockOperator/Jesse%20Livermore%20Reminiscences%20Of%20A%20Stock%20Operator.pdf

General Economics and Investing

While not necessarily for trading, it’s helpful to have a broad selection of different types of knowledge in your latticework of the mind as Charlie Munger calls it. In case you didn’t know, Charlie Munger is Warren Buffet’s right hand man at Berkshire Hathaway.

Investing , the last liberal art by Robert G. Hagstrom

This table of contents is what got my attention with this book. I was a bit caught of guard at first with the topics and the connection they might make to investing. But, a short skim confirmed the author was right on target with all of the topics covered.

Table of Contents: Investing: The last Liberal Art
Table of Contents: Investing: The last Liberal Art

I didnInvesting, the last liberal art’t know what to think of this book when I first saw it. But, it’s different from most investing books in a good way. It’s more about building a mindset, a latticework in your mind to pull from to better think about investing. Clearly, knowing other subjects beyond economics and finance are helpful to have a background of general knowledge to be able to pull ideas from. For me, I agree as this has been my own experience. This book went from one that I was skeptical about to a favorite after a few chapters.Initially the chapter titles caught my attention, as they were unlike any ones that I have seen in other investing books.

 

Principles of Economics by Alfred Marshall

Originally from 1890, it’s a classic. It’s still used in some college curriculums today. This book can provide a background on economics. With trading, you need to be able to understand the view from above as well. Understanding how economics works provides a high altitude view from far above the landscape of fundamentals and technical analysis. It’s important to a least have some understanding of the bigger picture, a macro view of economics from the beginning when you trade.

This is the 8th edition of what is regarded to be the first “modern” economics textbook, leading in various editions from the 19th into the 20th century. The final 8th edition was Marshall’s most-used and most-cited.

http://files.libertyfund.org/files/1676/Marshall_0197_EBk_v6.0.pdf

Crypto Compares Big Gains Q1 2019

Trading Resource Videos

There are many thousands of people who buy and sell stocks speculatively but the number of those who speculate profitably is small. As the public always is “in” the market to some extent, it follows that there are losses by the public all the time. The speculator’s deadly enemies are: Ignorance, greed, fear and hope. All the statute books in the world and all the rules of all the Exchanges on earth cannot eliminate these from the human animal. Accidents which knock carefully conceived plans skyhigh also are beyond regulation by bodies of coldblooded economists or warm-hearted philanthropists.– Reminiscences of a Stock Operator

 

Trading Resource Videos

The following post contains video resources. Some of this material especially the material from Francis Hunt and David Paul on the psychology and mindset of trading is quite important. It is best to learn about the psychology and mindset of trading while learning other typical trading topics such as technical analysis and fundamentals. It is just as important in the long run and having discipline and the right mindset goes a long way to preventing losses and maximizing gains over the long haul.

Channels

Josh Olszewicz: Crypto + Technical Analysis, Building your trading toolbelt

Josh Olszewicz produces market updates on a regular basis cover BTC and ETH primarily. Plenty to learn from and in my opinion, reliable insights.

https://www.youtube.com/channel/UC587BAG9cLTYtJ7Q4CqcOnw

Francis Hunt: The Crypto Sniper

Francis Hunt produces periodic crypto market updates and actually trades in legacy markets as well and provides useful insights from both realms and also currencies plus gold and silver.

https://www.youtube.com/channel/UCdC4a2KquFV1F4O21mW3K7g

Aswath Damodaran: Fundamentals and Value Investing in Stocks.

He is a professor, so get ready to study. Many videos on his channel. A few updates here and there but , most of it is in depth college level training on topics such as valuation and analyzing the fundamentals of companies. Good information for a background on the stock market. Plenty of videos to pick and choose from as you want to dive into a specific topic.

https://www.youtube.com/channel/UCLvnJL8htRR1T9cbSccaoVw

 

UKspreadbetting

Basics. Well done videos, most of them nice and short and covering specific topics. Everything that applies to spreadbetting can be applied to trading as well so don’t let the name fool you.

https://www.youtube.com/channel/UCnKPQUoCRb1Vu-qWwWituGQ

Trading 212

Basics. Watched a few videos off of this channel a bit of overlap with UKspreadbetting but short concise videos. Worth looking at.

https://www.youtube.com/channel/UCfWQuGYMfhZk9qq5x00sb9w


Series Worth Watching

Francis Hunt Interview Series on UK Spread Betting

Especially these two in the series are very important…
Trading Secrets of the Mind Master the Emotional Side of Trading
Improving the Mindset Game in our Trading

David Paul on UK Spread Betting

More David Paul Videos

 

https://www.youtube.com/watch?v=MGglyvc8d58&list=WL&index=113&t=0s

Subject: David Paul Tips from video

Asset above 89 day MA. Market above 21 day MA And rising , will get hit rate to 80 Probability matrix Pattern to finesse entry . 1-2 pct at risk per trade. Plan and repeated perfect execution. Build neural pathways after 8-30 trades…….. William O’Neil How to make money in stocks……from The Psychology of trading and investing

Audio book: Trading For a Living, Psychology,Trading Tactics, Money Management

 

Jim Simons

Not trading information specifically but, he is a legend. Mathematician, code breaker  turned trading genius. He co-founded Renaissance Technologies in East Setauket, New York, a town away from where I grew up. Renaissance Technologies, Ren Tech, makes huge yearly gains in it’s Medallion Fund. The company does a lot of quant work and hires PhD scientists, mathematicians and etc. Working for this company would be amazing to say the least. So much to learn there working with the talented people he has helped to pick and shape over the years.

Renaissance’s flagship Medallion fund, which is run mostly for fund employees,[8] is famed for the best track record on Wall Street, returning more than 66 percent annualized before fees and 39 percent after fees over a 30-year span from 1988 to 2018.[9][10]