//@LibraryID:987,0 //@Name:FTSE 100 Up & Down //@Description:Draws the difference between the FTSE 100 Up and Downs for each bar, the size of the bars is user selectable however, this must be the same as the bar size shown on the intraday chart. //@Type:Intraday // 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. var dataChoice = 0; var dataList = ["1m","2m","2.5m","3m","4m","5m","6m","10m","15m","20m","30m"]; var dataListSec = [60,120,150,180,240,300,360,600,900,1200,1800]; var colourUp = Colour.Green var colourDown = Colour.Red function init(status) { if (status == Loading || status == Editing) { dataChoice = storage.getAt(0); colourUp= storage.getAt(1); colourDown = storage.getAt(2); } if (status == Adding || status == Editing) { var dlg = new Dialog("Settings...",280,75); dlg.addOkButton(); dlg.addCancelButton(); dlg.addDropList("VAL1",35,5,35,-1,dataList,"Bar Size:","",dataChoice); dlg.addColPicker("VAL2",110,5,-1,-1,"Up Colour:","",colourUp); dlg.addColPicker("VAL3",190,5,-1,-1,"Down Colour:","",colourDown); dlg.addText(5,22,200,100,"You must make sure that the indicator is set to the same bar size as the chart otherwise nothing will be drawn.") if (dlg.show()==Dialog.Cancel) return false; dataChoice = dlg.getValue("VAL1"); colourUp = dlg.getValue("VAL2"); colourDown = dlg.getValue("VAL3"); storage.setAt(0, dataChoice); storage.setAt(1, colourUp); storage.setAt(2, colourDown); } setSeriesColour(0, colourUp, colourDown); setSeriesChartType(0, ChartType.Histogram); setSeriesColourMode(0, ColourMode.UpDown); setTitle("FTSE Up/Down ("+dataList[dataChoice]+")"); } function getGraph(share,data) { var list = getList(List.FTSE100) var upArray = []; var downArray = []; var outputArray = []; upArray[0] = 0; downArray[0] = 0; outputArray[0] = 0; for(var j=0;jiData[i-1].close) { upArray[i]==undefined?upArray[i]=1:upArray[i]++ } if(iData[i].close