//@Name:Volume ROC //@Description:Rate of Change indicator and signal based on volume data. // Care has been taken in preparing this code but it is provided without guarantee. // You are welcome to modify and extend it. Please add your name as a modifier if you distribute it. //Coded by: Richard Chiesa, ShareScript Support var period = 20; var sigPeriod = 9; var lineCol = Colour.Magenta; var lineStyle = Pen.Solid; var lineWidth = 0; var sigCol = Colour.Magenta; var sigStyle = Pen.Dot; var sigWidth = 1; function init(status) { if (status==Loading || status==Editing) { period = storage.getAt(0); sigPeriod = storage.getAt(1); lineCol = storage.getAt(2); lineWidth = storage.getAt(3); lineWidth = storage.getAt(4); sigCol = storage.getAt(5); sigStyle = storage.getAt(6); sigWidth = storage.getAt(7); } if (status==Adding || status==Editing) { var dlg = new Dialog((status==Adding?"Add":"Edit")+" indicator",180,44) dlg.addOkButton(); dlg.addCancelButton(); dlg.addIntEdit("INT1",8,8,-1,-1,"","period",period,2,1000); dlg.addNumEdit("INT2",8,24,-1,-1,"","signal",sigPeriod,2,1000); dlg.addColLinePicker("LN1",75,8,-1,-1,"","",lineCol,lineStyle,lineWidth); dlg.addColLinePicker("LN2",75,24,-1,-1,"","",sigCol,sigStyle,sigWidth); if (dlg.show()==Dialog.Cancel) return false; period = dlg.getValue("INT1"); sigPeriod = dlg.getValue("INT2"); lineCol = dlg.getValue("LN1").colour; lineStyle = dlg.getValue("LN1").pen; lineWidth = dlg.getValue("LN1").width; sigCol = dlg.getValue("LN2").colour; sigStyle = dlg.getValue("LN2").pen; sigWidth = dlg.getValue("LN2").width; storage.setAt(0, period); storage.setAt(1, sigPeriod); storage.setAt(2, lineCol); storage.setAt(3, lineStyle); storage.setAt(4, lineWidth); storage.setAt(5, sigCol); storage.setAt(6, sigStyle); storage.setAt(7, sigWidth); } setRange(Range.CentreZero); setHorizontalLine(0); setSeriesColour(0, lineCol); setSeriesLineStyle(0, lineStyle, lineWidth); setSeriesColour(1, sigCol); setSeriesLineStyle(1, sigStyle, sigWidth); setTitle(period+" ("+sigPeriod+" sig.) Volume ROC (M)"); } function getGraph(share, data) { var ma1 = new MA(sigPeriod); var main = []; var signal = []; for (var i=period;i