//@Name:100 SMA Divergence //@Description:Plot of Method used by Tom Hougaard to identify extreme moves away from trend // Tom Hougaard (City Index Chief Market Strategist- http://www.tradertom.com) // You see this mentioned on Bloomberg when he is on regularly at weekends // Original Script: 25/4/2008 : Written by Kenny Halley // http://www.halleynet.co.uk // Please feel free to modify or adapt as you see fit but please add your name here below original release info // Principle of Use: This graph is most useful on Commodities, Indices and Currencies but can be used on any instrument (less effective on stocks as they can go up and stay there) // Use graph to spot price spikes away from the 100 Day Simple Moving Average // Degree of % divergence differs by market but as an example spikes + or - 15% on the Gold Price show extreme divergences // When such a spike occurs there are two scenarios which could transpire: // 1) Price could go flat and eventually SMA would catch up // 2) Price will Snap back toward SMA (more typical) Snap back is usually very fast and quite extreme- take Gold snap back in March 2008 as example // To get a feel for its use run this along a long term chart like FTSE100 or DJIA over 5 years. From this you will get an idea of the normal deviation and the extremes for any market // When you see a wild extreme be ready for a sudden reversal to the mean. // Note: Horizontal lines have been added at +/-15% but these levels will be variable for different markets so feel free to edit. // Note: Viewing this with a tall y axis makes its message much clearer. // Care has been taken in preparing this code but it is provided without guarantee. function init() { setTitle("100 Day SMA Divergence"); setSeriesColour(0, Colour.Black); setSeriesLineStyle(0, Pen.Solid, 1); setRange(Range.CentreZero); setHorizontalLine(0); setHorizontalLine(15); setHorizontalLine(-15); } function getGraph(share, data) { //Edit this parameter to adjust SMA period 100 = default var period=100; var Divergence = new Array(); var ma1 = new MA(period, MA.Simple); for (var i=0; i