//@Name:Fall from high //@Description:Plots the percentage fall from the highest price. //Coded by: Paul Hall, ShareScript Support var period = 20 var col1 = Colour.Red var style1 = 0 var width1 = 1; var allData = 0; var fromHigh = 0; var titleList = ["close","high"]; function init(status) { if (status==Loading || status==Editing) { period = storage.getAt(0); col1 = storage.getAt(1); style1 = storage.getAt(2); width1 = storage.getAt(3); allData = storage.getAt(4); fromHigh = storage.getAt(5); } if (status==Adding || status==Editing) { var dlg = new Dialog((status==Adding?"Add":"Edit")+" % fall from high",220,60) dlg.addOkButton(); dlg.addCancelButton(); dlg.addIntEdit("INT1",8,5,-1,-1,"","period high",period,2,1000); dlg.addColLinePicker("LN1",54,40,-1,-1,"Line settings:","",col1,style1,width1); dlg.addTickBox("TK1",85,6,70,-1," use all time high",allData); dlg.addTickBox("TK2",9,25,150,-1,"use highest high instead of highest close",fromHigh); if (dlg.show()==Dialog.Cancel) return false; period = dlg.getValue("INT1"); col1 = dlg.getValue("LN1").colour; style1 = dlg.getValue("LN1").pen; width1 = dlg.getValue("LN1").width; allData = dlg.getValue("TK1"); fromHigh = dlg.getValue("TK2"); storage.setAt(0, period); storage.setAt(1, col1); storage.setAt(2, style1); storage.setAt(3, width1); storage.setAt(4, allData); storage.setAt(5, fromHigh); } setRange(Range.Parent); setSeriesColour(0, col1); setSeriesLineStyle(0, style1, width1); if(allData==0) { setTitle("Fall(%) from "+period+" period highest "+titleList[fromHigh*1]); } else { setTitle("Fall(%) from highest "+titleList[fromHigh*1]); } } function getGraph(share, data) { var band1 = new Array(data.length); var band2 = new Array(data.length); var output; if(allData==1) { var ahh = null; var ahc = null; for (var j=1;j