## 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!

## Zen & The Art of Trading

I’ve been listening to a lot of Allan Watts lately.   He is largely accredited for bringing eastern philosophy into to western society in a highly digestible way.  What I want to focus on is knowing without knowing.

As a trader we spend hours scanning charts, searching for the setups we know best, that we know have a high probability of reward.  Though if it was that simple we would just automate what we do and sit at the beach all day.  There is something more I believe.

There is a feeling that occurs, a knowing.  You look at the chart and you know what it will do.  As if you have some sort of pre-cognition.  What is this? As if the stars have aligned and you somehow intuitively know.  When your brain kicks in you may second guess yourself, change your mind, look for evidence to verify this feeling but you know what you know.

The mind, however wants to make up a story about why you feel this way.  It is pointless.  Just as fire does not burn itself, nor does a knife cut itself.  You will not know what you know by logic, thought, or evidence.  You just know…

How often do you feel this as a trader?  What do you do when you have this feeling?  Do you journal it? Do you always take the trade?  Keeping track of these moments is critical in my success because there is a high order knowing I believe that I do not have access too directly.  Perhaps over time with enough sample, I can begin to understand what I do know or at least plug it into a deep learning model 🙂

## 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 – States

Integral theory believes we enter different states of awareness, of consciousness, etc throughout any given day.   Have you ever been unable to break an angry mood? Your state was angry.  Have you ever been highly irrational for a long time? Your state was irrational.  Have you ever fell in love & were unable to fall out of it for a long time? Your state was in love.

States greatly effect the way we trade ever single day.  Author Denise Shull’s book Market Mind Games is essentially a book about emotional / psychology states.  Her book can be summarized as follows.  Be aware of your emotional context (state) it will greatly effect your trading decisions.  She’s correct.

This is a very basic overview of how states can effect you during trading.  Denise suggests writing down your emotional state as your are trading such as “I”m afraid to take this trade” or “If I lose on this trade I’m going to be very angry with myself.”  I added to this methodology by taking it a step further and after the bell has rung to go back and ask. What makes me afraid? or IfIi become angry with myself what would happen?

## 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.

## 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.