//@Name:Intraday Price Range //@Description:This script draws two lines bracketing the price range achieved on an intraday chart within the first X minutes of the trading day. High/Low or Close/Close price ranges can be selected. //@Type:Intraday //@Env:Production // 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: Phil Tolhurst, ShareScript Support var period = 30; var highClose = 0; var hcList = ["High/Low","Close/Close"] var colour1=Colour.Green; var width1=0; var pen1=0; var colour2=Colour.Red; var width2=0; var pen2=0; var cache = {}; function init(status) { if (status == Loading || status == Editing) { period = storage.getAt(0); highClose = storage.getAt(1); colour1 = storage.getAt(2); width1 = storage.getAt(3); pen1 = storage.getAt(4) colour2 = storage.getAt(5); width2 = storage.getAt(6); pen2 = storage.getAt(7) } if (status == Adding || status == Editing) { var dlg = new Dialog("Settings...", 250, 50); dlg.addOkButton(); dlg.addCancelButton(); dlg.addNumEdit("VAL1",75,7,-1,-1,"Minutes since open:","",period,0,9999); dlg.addDropList("VAL2",25,24,55,-1,hcList,"Use "," range",highClose); dlg.addColLinePicker("VAL3",155,5,-1,-1,"Upper Line:","",colour1,pen1,width1); dlg.addColLinePicker("VAL4",155,22,-1,-1,"Lower Line:","",colour2,pen2,width2); if (dlg.show()==Dialog.Cancel) return false; period = dlg.getValue("VAL1"); highClose = dlg.getValue("VAL2") colour1 = dlg.getValue("VAL3").colour; width1 = dlg.getValue("VAL3").width; pen1 = dlg.getValue("VAL3").pen; colour2 = dlg.getValue("VAL4").colour; width2 = dlg.getValue("VAL4").width; pen2 = dlg.getValue("VAL4").pen; storage.setAt(0, period); storage.setAt(1, highClose); storage.setAt(2, colour1); storage.setAt(3, width1); storage.setAt(4, pen1); storage.setAt(5, colour2); storage.setAt(6, width2); storage.setAt(7, pen2); } setSeriesColour(0, colour1) setSeriesLineStyle(0, pen1, width1); setSeriesColour(1, colour2); setSeriesLineStyle(1, pen2, width2); setRange(Range.Parent); //setTitle("VPT (Signal: "+maPeriod+maTitleList[maType]+")"); } function getGraph(share,data) { var shareIdStr = share.getShareScopeID()+":"+share.getShareNum(); var range = period*60; var upperLine = []; var lowerLine = []; var highHigh; var lowLow; upperLine[data.length-1]=null; lowerLine[data.length-1]=null; if(data == undefined || data.length == 0 || data[data.length-1].timeNum-data[0].timeNumrange) break; if(highClose == 0) {//High/Low if(data[i].high>highHigh) highHigh = data[i].high; if(data[i].lowhighHigh) highHigh = data[i].close; if(data[i].close