Multi Z-Score analysis

Category: Indicators By: Nicolas Created: June 26, 2018, 12:15 PM
June 26, 2018, 12:15 PM
Indicators
19 Comments

This indicator is a quick attempt to represent the distance of prices from their averages using the Zscore.
By using the DRAWTEXT graphical function in a loop, you can display a large amount of information at the same time.

The Zscore is calculated dynamically against several moving averages for as many “definition” periods. The variable “definition” is a multiplier.

What the indicator shows us is that the price both to return more quickly to its mean when few Zscore (1 Zscore = 1 point on the graph) exceeds a deviation of 2 standard deviations and that quickly, while many other points form a compact package.

Other observations could be formulated for different types of graphs, time horizons and ways to trade, I leave you the pleasure to test by yourself 🙂

//PRC_multipleZscore analysis | indicator
//26.06.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

//--- settings 
period = 20
MAtype = 1
definition = 100
//--- end of settings 

globalz=0

for i = 1 to definition do
 avg = average[period*i,MAtype](customclose)
 st = std[period*i](customclose)

 zscore = (customclose-avg)/st

 if zscore<0 then
  r=255-(30*i)
  g=0
  drawtext(".",barindex,zscore,Dialog,Bold,20) coloured(max(r,100),g,0)
 else
  r=0
  g=255-(30*i)
  drawtext(".",barindex,zscore,Dialog,Bold,20) coloured(r,max(g,100),0)
 endif

 globalz=(globalz+zscore*i)/definition

next
smooth=average[period](globalz)


RETURN 0 coloured(100,100,100) style(dottedline), 2 coloured(100,100,100) style(dottedline), -2 coloured(100,100,100) style(dottedline), 4 coloured(100,100,100) style(dottedline), -4 coloured(100,100,100) style(dottedline), smooth

 

Download
Filename: mean-reversion-with-Zscore-analysis.png
Downloads: 63
Download
Filename: PRC_multipleZscore-analysis.itf
Downloads: 219
Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Logo Logo
Loading...