//@Name:Choppiness Index //@Description:A directionless indicator designed to determine if the market is choppy (trading sideways) or not choppy (trending). A high value indicates high choppiness. var var1 = 14; var col1 = Colour.Red; function init(status) { if (status == Loading || status == Editing) { var1 = storage.getAt(0); col1 = storage.getAt(1); } if (status == Adding || status == Editing) { dlg = new Dialog("Indicator Settings...", 145, 55); dlg.addOkButton(); dlg.addCancelButton(); dlg.addIntEdit("INT1",8,-1,-1,-1,"","period",var1,2,1000); dlg.addColPicker("COL1",8,23,-1,-1,"","",col1); if (dlg.show()==Dialog.Cancel) return false; var1 = dlg.getValue("INT1"); col1 = dlg.getValue("COL1"); storage.setAt(0, var1); storage.setAt(1, col1); } setHorizontalLine(61.8); setHorizontalLine(38.2); setSeriesLineStyle(0,0,1); setSeriesColour(0, col1); setTitle(var1+" Choppiness Index"); } function getGraph(share, data) { var output = []; output.length = data.length; var min1 = new MinMax(var1); var max1 = new MinMax(var1); var tr = []; for (var i=1;i