Market Trends

Identifying market trends is like eating and drinking the Zeitgeist. It has to be inside you to understand it. You have to be social, go outside, go to parties, etc. If you're not "hip" then you'll never see emerging trends until they're already established. Then it's a matter of chasing their coattails and riding them for a bit.

Years ago Howie had a great tag-line for his blog, it was "Trends… Find them, ride them and get off." I thought that was a great way to frame the problem and represent one way to generate "alpha" for the short term. Get in on a trend before it takes off and then ride it up (or down). The next trick is getting out, as Howie so eloquently puts it, "ride them and get off."

Identifying Trends in Stocks

Trend following in stocks has been around ever since a market has existed. Tulips anyone? It's super easy to do if you access to a computer. All you do is load up your favorite stock, set the time period to daily or weekly, and it should become readily apparent which way the trend is going.

TRTC, 11/25/2019

Some traders and investors like to use moving averages, usually the 50 and 200 day/week moving averages to confirm that the stock is trending higher or lower. Since I like to be positive, I really like up trends relative to down trends, but both are very useful for things happening in the social sphere (see below).

Identifying Social Trends

This one is trickier because because it requires you to leave your computer screen and go out into society. You need to observe, read, mingle, and talk. I know that this can be tough for introverts - and a lot of good traders/investors I know are introverted - but you have to put on your social shield and go out.

Having kids is good too, or at least access to nieces and nephews. You can ask them what all the kids are buying or having bought for them. What are they playing, what's cool, etc. Right now it's Fortnite, Discord, and iPhones. This is how I learned about the Minecraft craze and ended up going long in Microsoft. Granted, Minecraft is now "so old" but it's still played by millions of people and Microsoft is doing well.

Note: I didn't just buy MSFT because my kid was playing Minecraft, I really like what their cloud strategy is for Machine Learning and Data Science. I think they're going to hurt Amazon and beat Google quite handily, but that's a topic for another post completely.

MSFT, 11/25/2019

But that's technology. What about retail, fashion, and other consumer type goods? For that you have to "go shopping" or at least visit the mall. I rely on my wife for a lot of retail and fashion stuff. For consumer goods or building related things I usually visit a Lowes or Home Depot.

TGT, 11/25/2019

I also talk to my Engineering friends, now that I'm out of that field. If they tell me they're busy right now then I can expect a 6 to 9 month follow through in the economy. Right now, they're not so busy because the holidays are coming. What happens in January will really sets the tone for 2020.

End Notes

While I like looking at stock charts, I really feel that the smart money is made when you buy and buy-in low. Of course you can get a clunker like TRTC (that's my loser from years ago), but with good risk management and a smart entry, you can really ride things up. Of course, you don't make any money until sell, and finding price point can be very hard. What are some good spots to sell? I'll share that in another post.


Downloading SEC.GOV data

I've finally found a way to download SEC.GOV data in a consistent and less stressful way. I want to give the University of Notre Dame Software Repository for Accounting and Finance a shout out for their excellent work. Thanks to them I can finally start taming this beast.

I've struggled for years trying to figure out how to download SEC data. That repository is so wacky that it's hard to find filings in there. The Notre Dame researchers created some python scripts that will let you automate the entire process. They even included parsing scripts that will extract textual properties of the document. These properties are what I like to call "pre-labels" or draft targets for machine learning.

After parsing the 100,000's of 8-K and 8-K/A documents, I was able to generate a referernce spreadsheet, see below. This is about 90% of the way to a final training set. All I need to do is generate a label from this information and then insert the entire SEC document into the training set (without HTML tags!). Still a few more preprocessing steps but it's almost there.

8-K SEC Documents Processed

There's a couple of things to note if you want to use their scripts, you'll need to tweak them to work for you. I took me about a day to figure everything out and then organize it the way I want to. I create a /downloader folder and put the scripts in there with an /EDGAR to hold all my downloaded text files.

For processing those files I created a /dataprep folder that contains all scripts that generate the "pre-labels." My future HTML preprocessing script will sit there first before I merge them together into the main script.

If you want to use these scripts note that they are not for commercial use. As of today the software is licensed as: "All software and data are provided on an "as is" basis, without warranties, for non-commercial purposes. The software is free for academic researchers."


Managing Your Time with Stoicism

Lately I've been reading Seneca as part of my exploration of Stoicism. There's a lot of great things here and I recommend you check out the video and my notes below:

To live well we must be constant students of life

  • Seneca's essay "On the shortness of life" reminds us that time is a non-renewable resource
  • Treat time as a commodity, people guard their property but squander time
  • The amount of time we get is uncertain, you could die at 20 or 100
  • Death creeps up on time wasters
  • Make the most of time, it is an amplifier when used properly

Don't invest your time preparing for life

  • Seneca pushes us to live right now and not to delay happiness
  • Your typical life is work till 60 and then wait to be happy
  • What usually happens is your old to enjoy life then and regret not making most of life
  • Planning the big things in life but don't delay living it

Live life for your own self

  • Being busy with things we don't like is the greatest distraction of your life
  • We waste time at jobs we don't like, relationships we're not happy in, etc
  • Invest your time into making a life worth living

Practice Premeditatio Malorum

  • While you waste your time by procrastinating, life goes on
  • Researchers call the dissonance of "short-term gratification vs long-term commitments" as time inconsistency
  • To fight this, use Premeditatio Malorum which is a form of negative visualization
  • Think of what could go wrong with your long term task and then make plans to achieve it. This will offset the distractions

Make Long Term Rewards Immediate

  • The need to procrastinate it he most powerful RIGHT at the start of work
  • When rewards are years away (i.e. diploma, career, et), you tend to procrastinate
  • To overcome, you must bundle a reward at the start of the task
  • You can eat a piece of cheesecake when you lost 10lbs or give yourself time to browse the web once you finished those pesky spreadsheet task

Make the Most of your Free Time

  • Too often we waste our free time with stupid stuff. Gossiping, drinking at the bar, etc
  • There's plenty of time to do everything we want if we just stop wasting our free time
  • We work hard to earn money and free time, so why waste that precious free time
  • Use your lunch hour to explore the city, write in a journal, play an instrument, reading, etc
  • To beat mediocrity and start living your life, make the most of your free time

Spend time reflecting on your past

  • Present time is transitory (it's moving), Future is uncertain, the past is unalterable
  • Seneca says pay attention to the past, so you can be effective today
  • Personal note: Journaling is a wonderful way of capturing the past

Stop Wasting Time in Life's Trivialities

  • We are all guilty wasting our time in trivialities (Social Media)
  • Social Media sucks your time away
  • When your happy you fill your time with activities that are valuable and meaningful to the vision you want of your life

Invest your time creating new memories

  • While you preoccupy your time with trivialities, death approaches that you can't escape
  • Invest your time into creating new memories and philosophies
  • Memory is more enduring than grief (Ed. Very true. I call it Adventuring)
  • Memories may be fleeting but they deliver more happiness than anything else
  • Do yourself a favor and take on challenges and adventures, learn to play music, travel, etc

Invest your time in Philosophies

  • The Study of Philosophy is the most invaluable teacher
  • Study as much of philosophy (current, past, etc) as you can because it will help you in your life
  • Your life will expand and your wisdom will grow
  • A Philosopher is a lover of wisdom: truth, virtue, life and death


Autogenerating Support and Resistance Lines for Forex

On the heels of my last post, I've extended those functions to the EURUSD pair. The data starts from this year 2019 and goes through to yesterday. It's actually a pretty neat script as it takes data from Onada and then generates the support and resistance lines for that particular pair. The next step would be to create a buy/sell order in the Oanda Practice Account. Once I do that it's then a matter of writing a trading strategy and testing it in real time.

Everything I'm doing is completely academic and modular right now. I have no idea how really build a Forex Trading Bot or even what strategies to use here. It's more of a "can I do it" endeavor.

Autogenerated Support and Resistance Lines, EURUSD

I'm fully convinced that retail traders that can learn Python can automate their entire trading strategies. Now, the flipside here is if their strategies are worth anything. Just because we can automated trading setups, we must always ask "why do I think I'm right?"


Autogenerating Support and Resistance Lines

Work has been keeping me busy but I found sometime to figure out how to autogenerate support and resistance lines. I cobbled together some code I found online and then made a simple plot. I'm doing this to help me identify the 'zones' in Forex (mostly) and see if I can automate a trading bot to make trades for me.

Here's a chart from two years worth of daily S&P500 closes. On the surface, the lines look pretty decent but the real trick is figuring out what the right lookback period should be. Here my lookback period was 20 days.

There's more work to be done, I have to fix the x-axis to show the dates and get a larger time period. I'm even testing automating this script into some dashboard. Right now you can see a crappy jpg of the EURUSD currency pair on my labs site.

The generic code to build these support and resistance lines is here.