TradingView
kurtsmock
Jun 29, 2020 2:06 AM

Probability: Bull/Bear Dominance | Ratio | Bar Count 

E-mini S&P 500 FuturesCME

Description

Intro
What's the probability of the next bar being red? How about green? Well, there are many ways to quantify the probability but I am presenting just one stupidly simple (but generally accurate) way to measure it.

Strangely... no one has done this before that I can find. I try to check if someone else has done it first (Pro Tip: Plz do this. We honestly don't need the 5 trillionth "MTF MAs" script.)

Indicator
Its a basic counting script, but the nice thing about this script is you choose the time range. It starts counting from a specified point of your choosing. It counts up the bull bars and bear bars separately.
Bull Bar = Close > Open
Bear Bar = Open > Close
You can look at them in sum or as a ratio of Green Bars : Red Bars

I know, it's almost too simple. But, here's some interesting food for thought from a layman to fellow laymen.

Analysis/Edge
Between the time of candle open and candle close, the price can do one of three things, close higher, close lower, or close equal to.
'Equal to' is rare on higher timeframes in liquid markets and it provides no useful information. Thus, we'll nix it for purposes of this conversation.
So boil it down. The next candle is going to be a red candle or a green candle.

It is popular to refer to the general probability of most candles as 50/50, with trader's mission in life being to seek an edge that tilts the probabilities slightly in their favor.
The truth is the odds are probably never actually 50/50, but knowing the precisely correct probability is unknowable, just like the accuracy of a weather forecast is inherently unknowable. What we're trying to do as traders is develop systems that give us predictive probabilistic outcomes that correspond with future realities based on various ways of measuring the market (most often heavily dependent on the past).

The reality is that the market can be measured in many, many different ways. The important thing is that you measure it in a way that is accurate, relevant, and universally applicable.

So look at this indicator here:
You start from a point in time on a chosen timeframe and you put red bars in the red column, green in the green column, and count them all up.
Then you make a ratio, in this case, Green : Red.
What the ratio shows you is the percentage of green bars compared to red bars. At the time of this screenshot, the 4h on the SPX starting from the 2020 bottom is showing a ratio of 1.2.
This means there have been 20% more green bars than there have been red bars.

Now there are 1,000 directions you can take this discussion. What is the overall volatility picture, the size of the red bars vs the green bars, what happens if you miss out on the 5 biggest green bars... so many more variables that you would need to take into account to develop a true edge from this idea. But, the bottom line fact (which is what I like about this) is that we can take this data and say with a certain level of confidence that on the SPX you have a 20% better shot at making money (otherwise stated there's a 60/40 chance) if you open a LONG trade at the beginning of a 4h candle than if you open a short.

That's useful information. One could argue that it's not a complete strategy in and of itself (although I bet it could be with a couple of additional parameters). But I can tell you, based on the 4h candles in the 2020 rally if you open a short, the deck is stacked against you from this perspective. And we can actually somewhat demonstrate this to be true for our dataset because we can look at the price history and see who likely made more money. The SPX is up 1000pts off the bottom. So, thus far, for this dataset, it rings true; Bulls have been doing way better in the latter part of 2020 than the bears.

Conclusion
Predictive systems with a small number of variables tend to be more robust than a system with many variables when applied to a complex system. I may keep updating this script if people like it and determine aspects like population vs sample size, confidence intervals, volatility, and exclusion of outliers. For now, this is just an opening foray into the basic idea of how we can establish an edge in the markets. It really can be this simple.

Thanks for Reading.

Release Notes

Balipour sent me a message deeming this script as complete nonsense and said "Please remove these tags so I don't have to report your script." So, there you go Balipour. I took the tags off for you. Now, please occupy your time dumping on someone else. Thanks.
Comments
dgtrd
nice study and indeed is a unique amongst the 5 billionth "MTF MAs" scripts :-)
please have a look at one of my studies of probablity implementing Bayes's Theorem, hope you find it interseting and different :-) tradingview.com/script/4uNKebPb-Bayes-Probability-Index-by-DGT/
Sorry the source code is protected but I stated all formulations in the description
MarxBabu
@dgtrd, good one
dgtrd
Thanks @MarxBabu :-)
kurtsmock
@dgtrd, Sorry, my friend. I never saw this comment till now. Thanks so much for the feedback and the contribution here. I like what you have going on there with the Bayes Theorem.
dgtrd
@kurtsmock, thank you very much ;-) you replied actually in the comments of my study ;-)

btw, i like your studies, all those probability, entropy staff, you are doing great
Things
@kurtsmock Great discussion, and elegant concept... my favourite. I agree generally and my initial thoughts were either:
A: providing a statistic edge going in favour of odds as is your example,
or
B:mean reversion: assuming eventual return to 1.

From an indicator standpoint I initialised it at 1:
ratio = bar_index < 1 ? 1 : greenCandle / redCandle

I'm guessing something about gaussian / power law distribution might be relevant. Also, from a charting perspective, we can only use maximum lookback to establish timeframe(sample size) for statistics but is appropriate?
Do we pull an average from a higher timeframe, or select as you have in your example period of a bull/bear run?

Any case, a nice thought.
MarxBabu
Thank you for this script ,It really helped me for some of my session related issue handling for my test and experiments.Good work and neat code too.Thank you.
kurtsmock
@MarxBabu, Heck yea man. I know exactly what yo umean. Session handling is a bear! I'm glad it was helpful.
jalexm
By the example graph it looks like the count is accumulated over time, are you going to be adding a lookback parameter to ensure that it can react in time when market changes? I think the simple idea is great, just seems as more time goes on you are really at the whim all the data from TV. Overall good stuff.
More