OPEN-SOURCE SCRIPT
Machine Learning Z-Score Buy and Sell [SS]

Hey everyone,
Releasing this Z-Score based buy and sell indicator.
What it does
This indicator:
What is Z-Score
Z-Score is a measure of the mean. Thus, this is a mean reverting type strategy, as it uses z-score to determine price's distance from the mean (or a Z-Score of 0) and then it looks at historic deviations from the mean to signal the buy and sell signals (i.e. how far has price traditionally drifted from the mean before reverting).
Z-Score is a powerful tool in this sense, and if you folow my other indicators, you will know how much I love Z-score!
How to use the indicator
If you want to use the full Machine Learning capabilities of the indicator, its best to just leave all default settings. These default settings will automatically adjust the mean target price and buy and sell signals to align with the current price action.
If you want to be more aggressive in your
Then you can opt to manually input a lookback length and mean reversion standard deviation. However, I generally suggest to avoid this as you are then making your own determination of trend by qualitative assessment. It can work, but its just not suggested.
In the input menu, you will see the option to "Manually select lookback" thus over-riding the auto-determination of trend and targets.
You will also see "manual pullback" enabler and "Pullback Standard Deviation". You can set your pullback standard deviation if you want to be more aggressive. The indicator will naturally shift to conservative target prices based on a neutral mean. However, if you want to increase the aggressiveness of the target price, you can increase or decrease the pullback standard deviation.
General Tips about Manually Adjusting Pullback Target
Here are some tips if you want to manually adjust the pullback targets:
Again, I do suggest leaving the indicator to decide for itself, but the options are there for those who wish.
Overall strategy
This is a mean reverting strategy. So if you are a mean reversion trader, this may be of particular interest to you.
Optional
Optionally, you can have the indicator plot the target prices or not, simply toggle this functionality off or on in the settings menu.
Concluding remarks
That is the indicator in a nutshell!
I hope you enjoy it and find it helpful.
Feel free to check out my other Z-Score based indicators if you find this interesting or want to learn more about the power of Z-Score in trading!
Thanks all and safe trades!
Releasing this Z-Score based buy and sell indicator.
What it does
This indicator:
- Uses Z-score and trend to identify potential buy and sell areas.
- Signals those buy and sell areas and provides a target price based on the mean.
- Plots the target price for buy and sell signals as a red line (for sell signals) or green line (for buy signals).
- Has some "machine learning" aspects, namely, it is able to auto select its lookback length based on its analysis of the trend using Pienscript's trend correlation function iterated over multiple lengths, in order for the indicator to identify:
a) The strongest trend; and
b) The correct target price
What is Z-Score
Z-Score is a measure of the mean. Thus, this is a mean reverting type strategy, as it uses z-score to determine price's distance from the mean (or a Z-Score of 0) and then it looks at historic deviations from the mean to signal the buy and sell signals (i.e. how far has price traditionally drifted from the mean before reverting).
Z-Score is a powerful tool in this sense, and if you folow my other indicators, you will know how much I love Z-score!
How to use the indicator
If you want to use the full Machine Learning capabilities of the indicator, its best to just leave all default settings. These default settings will automatically adjust the mean target price and buy and sell signals to align with the current price action.
If you want to be more aggressive in your
- Target Price; and
- Signals
Then you can opt to manually input a lookback length and mean reversion standard deviation. However, I generally suggest to avoid this as you are then making your own determination of trend by qualitative assessment. It can work, but its just not suggested.
In the input menu, you will see the option to "Manually select lookback" thus over-riding the auto-determination of trend and targets.
You will also see "manual pullback" enabler and "Pullback Standard Deviation". You can set your pullback standard deviation if you want to be more aggressive. The indicator will naturally shift to conservative target prices based on a neutral mean. However, if you want to increase the aggressiveness of the target price, you can increase or decrease the pullback standard deviation.
General Tips about Manually Adjusting Pullback Target
Here are some tips if you want to manually adjust the pullback targets:
- The pullback target needs to be in a standard deviation value, this can be anywhere from 0 to 4 or 0 to -4 (you can theoretically go higher but its not really realistic). You can also do decimals, so 1.5 or 1.25 etc.
- To determine whether you should be doing negative or positive standard deviation, you should determine the trend. If it is a downtrend and you are looking to short the rips, you will want to select a negative number, like -1.
- If it is an uptrend and you want to buy the dips, you should be selecting a positive number, like 1 or 1.5.
Again, I do suggest leaving the indicator to decide for itself, but the options are there for those who wish.
Overall strategy
This is a mean reverting strategy. So if you are a mean reversion trader, this may be of particular interest to you.
Optional
Optionally, you can have the indicator plot the target prices or not, simply toggle this functionality off or on in the settings menu.
Concluding remarks
That is the indicator in a nutshell!
I hope you enjoy it and find it helpful.
Feel free to check out my other Z-Score based indicators if you find this interesting or want to learn more about the power of Z-Score in trading!
Thanks all and safe trades!
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
Get:
- Live Updates,
- Discord access,
- Access to my Proprietary Merlin Software,
- Access to premium indicators,
patreon.com/steversteves
Now on X!
- Live Updates,
- Discord access,
- Access to my Proprietary Merlin Software,
- Access to premium indicators,
patreon.com/steversteves
Now on X!
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
Get:
- Live Updates,
- Discord access,
- Access to my Proprietary Merlin Software,
- Access to premium indicators,
patreon.com/steversteves
Now on X!
- Live Updates,
- Discord access,
- Access to my Proprietary Merlin Software,
- Access to premium indicators,
patreon.com/steversteves
Now on X!
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。