TradingView
Steversteves
14 ינו׳ 2024 03:54

Math Trading Concepts [SS] 

SPDR S&P 500 ETF TRUSTArca

תיאור

Presenting a mashup of the key elements I use for day-to-day trading: Volume, Z-Score, Autoregressive Forecasting, and a new addition, ANOVA analysis of variance.

I've aptly named it "Math Trading Concepts" in a nod to established trading concepts like "Smart Money" and "liquidity," but it's also fitting because these elements are fundamental to most quantitative/mathematical trading strategies.

What does it do?

The indicator visualizes Z-Score bands over a user-selected lookback period (defaulted to 14), akin to Bollinger Bands. Within these bands, it provides additional data, including trend identification. Uptrends are displayed in varying shades of green (brighter for stronger trends), while downtrends appear in red (with intensity reflecting strength).

Now, let's delve into each point individually:

Volume:
The indicator converts volume into a Z-Score over the specified lookback period. It distinguishes between buying and selling volume, calculating separate Z-Scores for each. A signal is triggered when the Z-Score exceeds 2 (for buying) or falls below -2 (for selling).

Z-Score:
The Z-Score clouds represent the outer parameters of the standard deviation over the lookback period (set at 2 and 3). Users can adjust the lookback time, and the indicator analyzes previous Z-Score reversal areas over the last 75 candles, signaling buy or sell based on historical reversals.

If you want to make it like BB, select the lookback length for the Z-Score at 25.

Autoregressive Forecasting:
This unique approach to autoregressive forecasting involves regressing a lagged variable while incorporating a time element. The time length is auto-determined based on the strongest trend. The indicator plots both autoregressed highs and lows.

ANOVA:
ANOVA, a discovery of mine, is introduced here. It reliably triggers significant readings before a pivot or breakout by measuring variance between means. When a statistically significant ANOVA occurs using the high, low, and close lagged values, it indicates an impending significant market move. While ANOVA alerts are not specific about the nature of the move, complementary tools like Volume, trend analysis, and Z-Bands provide additional insights.

Expect more educational content on ANOVA in the future, given its unique discovery. I was hoping to do one before releasing anything ANOVA based but alas, I haven't had the time!

The remainder of the indicator is self-explanatory. Feel free to ask any questions that arise or were not addressed in this description.

Special thanks to @Trendoscope for his arrays library which has made it possible for you to use the autoregression forecast while actively trading without it intruding on the chart :-).

Safe trades, everyone!

הערות שחרור

I forgot to include the autofit linear regression channel.
As this indicator is a combination of all the different stuff I use in the course of a day while trading, I wanted to be sure to include all of the tools I will reference.

This feature will autofit a linear reg channel extended by 3 standard deviations (you can see in the updated chart that SPY is approaching the top of the channel at 3 standard deviations).
It will offset based on the start of the trend and extend based on the current strongest trend.

תגובות
dmnik
THERE WERE ERRORS CLEARED!

// Volume Analytics
vol_sma = ta.sma(volume, z_len)
vol_stdev = ta.stdev(volume, z_len)

buy_vol = request.security(syminfo.tickerid, "", close > open ? (volume - vol_sma) / vol_stdev : na, lookahead=barmerge.lookahead_on)
sell_vol = request.security(syminfo.tickerid, "", close < open ? (volume - vol_sma) / vol_stdev : na, lookahead=barmerge.lookahead_on)
Reall_Deal_Neil
Its back testing looks good and those reversing signals were on point. Thanks again for your skills.
I was wondering about if you had a signal indicator that you would use alongside this one for more confluence? I’ve had a trying time with the predictive candles and other predictive indicators because I trade eminnis and it’s so frustrating getting stopped out and then watching it play out eventually. So any suggestions would be appreciated. Thank you. Neil
Steversteves
@Reall_Deal_Neil, So I do, but it comes in the form of rules and around my RPPI's. If something is below the bearish condition or has a bearish condition breakout, I presume the bias needs to be short and look for only short setups and loosen the stops to the upside. Obviously the past few weeks I have just ignored everything and only ever looked for longs haha, but as a general rule, the conditional breaks are really what guide my overall bias, paying attention to where we are on the weekly and where we are on the daily are very important.
The other thing I use is an autoregressive cloud indicator which plots the expected range based on an autoregression model. It looks similar to this indicator here but its operation is much different (it creates its own math model, where as this just plots standard deviation in the same way bollinger bands does).
Unfortunately, both the auto-regression and RPPI are not yet released, but will be released (though as a paid premium indicator) on Friday :-).
Steversteves
@Reall_Deal_Neil,

This is the autoregressive cloud I was talking about. It has become my go to because its incredibly reliable, especially on the indicies.
Reall_Deal_Neil
@Steversteves, Ah ha! Nice… This still keeps the chart clean too. ;) I wonder if the middle line is on par with the range or the intraday point of control too… I’ll check back with you next weekend. :)
dmnik
I have corrected these errors in the post below!
dmnik
Compilation...
22:05:46 Error at 147:75 The function 'ta.sma' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope
22:05:46 Error at 147:100 The function 'ta.stdev' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope
22:05:46 Error at 148:76 The function 'ta.sma' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope
22:05:46 Error at 148:101 The function 'ta.stdev' should be called on each calculation for consistency. It is recommended to extract the call from the ternary operator or from the scope
Steversteves
@dmnik, Its okay, its a non-critical error and will work as its coded. Doing it as it requests will lead to unreliable results. Its an error I always just ignore.
Awsm-Jack
Thank you very much for your work!
I have a question, if you have time.
In this indicator tradingview.com/script/mmyFvori-Z-Score-with-Buy-Sell-Signals/ you said : "Anything above this, we can interpret that there is "stress" on the stock. Anything over 2.50 is tremendous stress on the stock and we can anticipate that it will want to revert to its mean in the near future and bring that value down to at least 1, ideally between the -0.5 and 0.5 range.
Please note, I set the standard VERY high for the indicator to issue a buy and sell signal (</= -2.50 and >/=2.50)."
That's the opposite of what you say in this one (as you treat a +2 Z-score as a buy signal). This is probably a misunderstanding of your explanation, but I wanted to ask you if you had time to answer.
Steversteves
@Awsm-Jack, Ah in this indicator it is is only for the volume because that is what my volume indicators are set to and very reliable, the actual Z-Score reversal point isn't set at anything, its algo driven (identifying the last z-score that led to a reversal).
Does that make sense?
עוד