Slippage and Root Mean Squared Error in Model performance

REAL traders all know how important slippage is.  You wanted to buy at 20.05 but got filled at 20.07.  Then you wanted to exit at 20.55 but got filled at 20.52.  The $0.02 on the went in and the $0.03 on the way out is what is referred to as slippage or skid. Total slippage $0.05

When building mix models I always incorporate slippage but where has become an increasingly important question in my work.  It’s similar to when people run a regression analysis on data that has no linear time factor built it.  You have no idea if Y preceded X or X preceded Y.  Running a linear regression doesn’t make this so.

Root Mean Squared Error or RMSE is one of many ways to compare regression models.  The formula is SQRT(mean((Observed_data- Predicted_Value)^2)).

When building models I often have a maximum profit from the trigger point (trade entry).  Back to our example. If I bought in at $20.07 and the highest print on the chart that day was 20.77. Max Profit would be $0.70.  My question to answer is typically what features will allow me to predict that $0.70 with the least amount of error & risk.

SLIPPAGE MATTERS! BIG TIME! I ran a Monte Carlo. 10,000 iterations. Running the same model where slippage was not subtracted from max Profit and when it was.  These were the results.

There are MANY interpretations of this.  I’ll offer a few.

  • RMSE is sensitive to large numbers creating the flaccid bi-nomial distribution in the bottom graph.  Large numbers potentially produced by small max profits and large spreads. IE CMG’s spread is about $0.20 where could be Max Profit = 0.05.
  • The top graph RMSE, max profit, is normally distributed in this model because individual stock differences for max profit are not enough to disrupt the distribution.  Which suggests that my ability to predict a stock is potentially easier.
  • SPREADS MATTER! The difference between the two graphs is caused by individual stock characteristics in the spread.  Like, two people, no spreads are ever really the same.  The error for my prediction goes up as we account for individual differences.

I think this illustrates something we experience every day in life. We have general predictions about what people will do in a given context (features) but everyone often does something unique which can not be accounted for.  I believe the bottom graph illustrates this.  It also illustrates why your real life trading profits may not reflect model performance if slippage is not included.  Because what happens. When I thought I was going to make $50.00 I only made $35.00…. Slippage!

 

How to Keep a Trading Journal

The Easiest Way to Keep a Trading Journal – A Great Trading Tool. Trading Journals are critical to all traders development. Learn how to keep one properly and easily with integral theory.

Keeping a trading journal is a critical aspect of becoming a good trader.  You’ll never know what you did wrong unless you can objectively witness the prior trades you took; good or bad.  Then the next question becomes well once I’ve witnessed my profitable trade or error how I avoid it again?  We’ll chat about that in another blog called “How to practice trading.”

There are so many ways, tools, and programs that will help you keep a journal but if you are like me none of them really stuck or worked well for my day trading style.  After all, who has time to spill all their emotions, intuitions, and thoughts while trading?! Not to mention market conditions, entry & exit prices and who else knows what information may be relevant to your style.  To me text is dead in this case. It’s too slow and you have more important things going on than talking about your stupid feelings. 🙂

We are going to draw on integral theory’s quadrants to establish a methodology that will allow us to focus on all aspects of the trade.  You can do this with pictures, text or video.

How to create a trading journal.

Upper left Quadrant: What were the intra-day fundamentals. Essentially why were you looking at this stock? Did you get an alert? Did you see if pop up because of a signal from trade idea? Did your algo say, “buy here.”  Did they release earnings? Did they get an upgrade?   These are some examples of the interior aspect of a trade.  Think “why am I trading this stock.”

Upper Right Quadrant:  Essentially we are talking about Technical analysis.  Did it come into a supply zone? Did it make a head & shoulders top? Did it have a candle stick pattern you liked? Objectively, what was this stock doing? Chopping? Trending? etc

Lower Left Quadrant: This is where it can get tricky this quadrant is about shared meaning/value. An example of this is language.  I interpret this now as the sentiment of the stock.  What do WE, as a collective, believe about this stock? What do WE as a bull (or bear) believe about this stock?

Lower Right Quadrant:  Intersubjective.  Economic systems fall into this category, so would a mechanical failure on the stock exchange.  It can also be interpreted as: What was the market doing? How did the SPY or Oil or whatever market gauge you like to use, perform with your stock? What artifacts were left behind? Do you see a stream of red candles of green?

This would Look like the following:  You can either download a program like Greenshot to capture pictures from your screen and edit them (this is a free version of snagit) or write in a journal when you want. Displaying the picture will give you the best idea of how to review your trades using integral theory and create the trading journal that will hopefully make you a better trader.

Remember you want a journal that will cover all aspects of why you did what you did without taking up loads of your time.  You need the best information and I believe integral theory helps focus us to pull only relavent information.

As I continue my study of Integral theory by Ken Wilber my understanding of it changes.    This is, according to my understanding, is the first attempt to understand finance in an integral frame work.  This is Integral applications In finance.

Integral Theory – Levels of development in trading

To again, continue my series on how I use integral theory to trade the stock market we now move onto levels of development on each of the lines I discussed.

This is the piece of Ken Wilber’s theory that he “borrowed” a lot from other traditions.  Personally, I think this is one of the coolest aspects of his theories.  The book Integral Psychology does a great job mapping out how all these different theories of development are talking about the same thing just at difference stages in life.  I highly recommend the book.

How do development lines work?  If you ever heard of Freud’s psychosexual stages of development that is a developmental line.  Another example is Piaget’s stages of cognitive development.  The most popular set of development stages within the integral framework tends to be spiral dynamics.  This is metaset, in my opinion, of development that can be applied to any line.  I’ll illustrate an example below.

The Line of development will be pattern recognition.  The development stages of pattern recognition could be interpreted as follows.

Beige – Instinctive / survivalist: Reading books on technical analyse & finding patterns that match exactly what you have read.

Purple – Magical / Animistic: Believing you see the patterns in everything.  The street lights form a double top and every time frame you look at hold exceptionally strong cup & handles, for example.  You find a “holy grail” of patterns

Red – Impulsive / Egocentric:   The patterns no longer work and you are angry. You find failing example after failing example.  The belief in the “holy grail” has died.

Blue – Purposeful / Authoritarian: You seek more education believing someone must have the “holy grail.”  You take this person or educational doctrine word for word.  You start to relive the “holy grail” experience that you originally had but it is now done with a stronger authority figure.

Orange – Achievist / strategic : Acting in your own self-interest.  “This guy doesn’t know what he’s talking about but I do.”  This is where you may begin to turn heavily towards statistics to validate your patterns and see how often they do work.  You will turn to more scientific methods.  [Side note: this orange phased is theorized to have only begun 300 years ago]

Green – Communitarian / Egalitarian:  Seek peace with self & others.  You now realize you know what you don’t know and don’t know that which you don’t know.  You have accepted the idea patterns work and patterns fail. That there is no holy grail.  You may even begin to share your knowledge with others.

A picture below should help bring these ideas together.  Remember moving on to the next level does NOT mean you are no longer part of the lower levels.  As you transcend the previous level you include you! You never disregard the previous levels.  Even though you may recognize patterns at a “Green” level of development, it doesn’t mean that “beige” is no longer a part of you.

Daily Trading Goal: Choose Your Thoughts

Today’s Daily Trading Goal focuses on how to choose your thoughts.  Thoughts effect your biology and your biology greatly effects your ability to trade through hormones.   Which thoughts you choose to pay attention to is critical.  Listen & choose to think good thoughts.

How I use integral theory to trade the markets

Integral theory is a beast.  You can read Ken Wilber‘s works over a lifetime only to come back to read them again and realize how much you missed.  My friends who introduced me to the theory always found great ways to answer my practical application questions from this theoretical model.  This and other posts will be my attempt to do the same for stock market trading.

As I discussed in a previous post.  Quadrants a great way to know your current perspective on things.  But how do we use the other 4 tenants?

Quadrants: Great for perspective.  Figuring out where your thoughts are and most importantly where other people’s thoughts may be as well.  This is simply a matter of perspective taking methodically.

States:  Are you angry? Stressed? Joyful? Irrationally exuberant?  In Flow?  This is the current state of your being. What’s coloring your trading ideas.  Maybe even confirmation bias.

Lines:  These are the skills people obtain throughout life. Relevant to trading I see pattern recognition, math, probability and high social IQ as skills worth developing for this business.

Levels:  Each of these skills will have levels that will build on the next.  There is no stagnation unless you choose.

Types: Gemini or Capricorn? OCD or free spirited?  How do you type yourself as a trader? Do you believe the hype that you can put in 2 hours of work a day and walk away a millionaire? Do you believe it takes hard work and practice?  This is typing yourself.  It is also called priming in the field of psychology.

I will write about each of these in more detail in future posts.

Daily Trading Goal – Caught in Your Own Thinking

Today’s daily trading goal is to stop getting caught up in your thinking.  In psychology,  one aspect of this is the confirmation bias.  Where view almost all information as confirming our original thoughts.  Stop this by wearing aware it exists.  Be mindful of your thoughts.

Daily Trading Goal – Focus on the Challenging Tasks

Focus on the challenging tasks.  There is only so much time in a day and while completing small easy tasks is great short term reward focusing on the more difficult tasks while you have the most energy will yield an even better reward.

Daily Trading Goal – Don’t Sweat the Small Stuff

Today’s trading goal is: Don’t Sweat The Small stuff.  If you let the small stuff go (getting filled a few cents below or above your limit. Let it go.  The energy spent on being frustrated can be focused on creativity and development as a trader.

Lesson of the Week – Perseverance

Nothing says failure like giving up.  This week, while optimizing and running walk-forward tests on upwards of 12 stocks with 5 tests each, I was confronted with this FAILED almost every morning I woke up.

To wake up every morning seeing the word FAILED in bold capital letters plastered across the screen can weaken your resolve that it’s even possible to make money in the market using automated strategies.  After a few days, I saw PASSED! I was ecstatic! 

I could feel the rush of dopamine flood my brain like a well trained rat pushing that level for a fix.  Of course, the moment was fleeting and further degraded as the next FAILED came up again and again.

I was soon reminded of Carel Dweck’s groundbreaking research in Mind Set.  Focus on the process, the growth, what you learned NOT the outcome.  I supposed that’s a beautiful element of being human: how quickly we can be overtaken by our ancestral brains.  I’m not a zen monk and I won’t pretend that seeing FAILED doesn’t bother me but refocusing on the process made the work less emotionally draining.

Focus on the process, not the outcome.

What was my process?  :

  1. Find stocks that “look” like they trend
  2. Run optimizations with at least 10k bars in each & 1 year worth of data
  3. Run walk forward analysis
  4. Log it
  5. Live paper money test for PASSED

The process is productive, thinking about FAILED is not.  Keep persevering, focus on the process.