Volatility, Volume, and Price Z-Scores For ThinkOrSwim

StoneMan

Member
Plus
Hey everyone, I have been working on weighting various indicators by volume and volatility to try and make my analysis more holistic. I wanted to share one here that I think has the potential to be pretty useful. It's the Z scores of volume, volatility, and price on one plot. The overall goal is using the volume and volatility Z scores to help confirm what you are looking at. In the picture below, the yellow line is close price Z score, the pink volume, the blue true range, and the gray open minus close. More explanation is in the code.

Ruby:
#Volitility Volume Price Z-Score
#StoneMan (StoneF)
#6.2.2023
#V1.0
#Looks at Z score of price action, volatility, and volume for more comprehensive analysis

#Brief statistics lesson:

#Z score is data's relationship to its mean divided by its standard deviation
#The zero line represents the mean values above the mean are positive and below negative
#The values of 1.645 and -1.645 represent the level of which 95% of the data is expected to fall below and above assuming standard normal distribution
#In practical application of this indicator that provides a good "overbought" and "oversold" level

#How to use:

#I have found the best use of the indicator in looking for "jaws" between price and volatility and volume
#When price is below -1.645 and volatility and volume above 1.645 wait for those values to begin to converge to 0
#I have found a good signal to be when price Z score slope turns positive and volume and volatility fall below 1.645
#Confirmation may have to be when price crosses back above 1.645, use discretion
#Similar overbought conditions can be traded with the same method look for all lines above 1.645 in this case
#Do to the "escalator up elevator down" phenomenon I have found the "jaws" method for dip buying to be a clearer signal

#Note:
#Two ways to obtain volatility are provided you can use either or both with price and volume
 
declare lower;

input Length = 10;

#Calculating volitility Z-Score using true range
def TrueRange = TrueRange(high, close, low); #Observed value
def TR_Average = Average(TrueRange, Length); #Mean of sample
def TR_StDev = StDev(TrueRange, Length);     #Standard Deviation of sample

def TR_Z_Score = (TrueRange - TR_Average) / TR_StDev;

#Calculating volume Z-Score
Def V = Volume;                     #Observed value
def V_Average = Average(V, Length); #Mean of sample
def V_StDev = StDev(V, Length);     #Standard Deviation of sample

def V_Z_Score = (V - V_Average) / V_StDev;

#Calculating volitility Z-Score using difference between open and close
def OpenCloseDiff = AbsValue(open - close);      #Observed value
def OCD_Average = Average(OpenCloseDiff, Length); #Mean of sample
def OCD_StDev = StDev(OpenCloseDiff, Length);     #Standard Deviation of sample

def OCD_Z_Score = (OpenCloseDiff - OCD_Average) / OCD_StDev;

#Calculating Close Price Z-Score
Def C = Close;                      #Observed value
def C_Average = Average(C, Length); #Mean of sample
def C_StDev = StDev(C, Length);     #Standard Deviation of sample

def C_Z_Score = (C - C_Average) / C_StDev;

Plot TrueRange_Z = TR_Z_Score;
Plot Volume_Z = V_Z_Score;
plot OpenMinusClose_Z = OCD_Z_Score;
plot Close_Z = C_Z_Score;
plot ZeroLine = 0;
Plot Upper95 = 1.645;  #95th percentile
Plot Lower95 = -1.645; #95th percentile




oEtIJaD.png
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
528 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top