//@Name:CMF //@Description:Chaikin Money Flow Indicator // 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 = 21; var lineCol1 = Colour.Green; var lineCol2 = Colour.Red; function init(status) { if (status==Loading || status==Editing) { period = storage.getAt(0); lineCol1 = storage.getAt(1); lineCol2 = storage.getAt(2); } if (status==Adding || status==Editing) { var dlg = new Dialog((status==Adding?"Add":"Edit")+" indicator",180,45) dlg.addOkButton(); dlg.addCancelButton(); dlg.addIntEdit("INT1",8,8,-1,-1,"","period",period,2,1000); dlg.addColPicker("COL1",20,24,-1,-1,"Up","",lineCol1) dlg.addColPicker("COL2",75,24,-1,-1,"Down","",lineCol2) if (dlg.show()==Dialog.Cancel) return false; period = dlg.getValue("INT1"); lineCol1 = dlg.getValue("COL1") lineCol2 = dlg.getValue("COL2") storage.setAt(0, period); storage.setAt(1, lineCol1); storage.setAt(2, lineCol2); } setRange(Range.CentreZero); setHorizontalLine(0); setSeriesColour(0, lineCol1, lineCol2); setSeriesChartType(0, ChartType.Histogram); setSeriesColourMode(0, ColourMode.UpDown); setTitle(period+" CMF"); } function getGraph(share, data) { var CMF = []; var sum1, sum2; for (var i=0;i