//@Name:Index Open Time //@Description:Draws a vertical line at the market open times of up to three indices. //@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 sh = [getShare("USI:DJI"),getShare("GER:DAX"),getShare("UKI:UKX")]; var show = [true,true,true]; var col = [Colour.Red,Colour.DarkGreen,Colour.DarkCyan]; var daysMarked = 10; function init(status) { if (status == Loading || status == Editing) { show = [storage.getAt(0),storage.getAt(1),storage.getAt(2)]; sh = [getShare(storage.getAt(3)),getShare(storage.getAt(4)),getShare(storage.getAt(5))]; col = [storage.getAt(6),storage.getAt(7),storage.getAt(8)]; } if (status == Adding || status == Editing) { dlg = new Dialog("Settings...", 200, 75); dlg.addOkButton(); dlg.addCancelButton(); dlg.addTickBox("TB1",8,8,10,-1,"",show[0]); dlg.addSharePicker("SP1",25,6, -1, -1, "", "", sh[0]); dlg.addColPicker("COL1",100,6,-1,-1,"","",col[0]); dlg.addTickBox("TB2",8,28,10,-1,"",show[1]); dlg.addSharePicker("SP2",25,26, -1, -1, "", "", sh[1]); dlg.addColPicker("COL2",100,26,-1,-1,"","",col[1]); dlg.addTickBox("TB3",8,48,10,-1,"",show[2]); dlg.addSharePicker("SP3",25,46, -1, -1, "", "", sh[2]); dlg.addColPicker("COL3",100,46,-1,-1,"","",col[2]); if (dlg.show()==Dialog.Cancel) return false; show[0] = dlg.getValue("TB1"); show[1] = dlg.getValue("TB2"); show[2] = dlg.getValue("TB3"); sh[0] = dlg.getValue("SP1"); sh[1] = dlg.getValue("SP2"); sh[2] = dlg.getValue("SP3"); col[0] = dlg.getValue("COL1"); col[1] = dlg.getValue("COL2"); col[2] = dlg.getValue("COL3"); storage.setAt(0, show[0]); storage.setAt(1, show[1]); storage.setAt(2, show[2]); storage.setAt(3, sh[0].getShareScopeID()); storage.setAt(4, sh[1].getShareScopeID()); storage.setAt(5, sh[2].getShareScopeID()); storage.setAt(6, col[0]); storage.setAt(7, col[1]); storage.setAt(8, col[2]); } } function onNewChart() { var share = getCurrentShare(); var dates = []; setAltRange(0,100); useAltRange(true); for (var i=0;i