//@Name:Pivot Points for Intraday Graphs //@Description:Draws Pivot Points based on the previous bar's OHLC data on the intraday graph, like ShareScope's PP function, and allows you to extend the final pivot points into the future. //@Env:Production //@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. // Coded by: Phil Tolhurst, ShareScope Support var colour1 = 16711680; var colour2 = 65025; var colour3 = 255; var pen1 = 0; var pen2 = 1; var pen3 = 2; var width1 = 0; var width2 = 0; var width3 = 0; var drawFuture = 1; //Draws the Dialog box and stores the values set so that they can be recalled either when starting the program or when edditing the indicator. function init(status) { if (status == Loading || status == Editing) { pen1 = storage.getAt(0); pen2 = storage.getAt(1); pen3 = storage.getAt(2); width1 = storage.getAt(3); width2 = storage.getAt(4); width3 = storage.getAt(5); colour1 = storage.getAt(6); colour2 = storage.getAt(7); colour3 = storage.getAt(8); drawFuture = storage.getAt(9); } if (status == Adding || status == Editing) { var dlg = new Dialog("Alternative Pivot Lines", 200, 100); dlg.addOkButton(); dlg.addCancelButton(); dlg.addGroupBox(5,5,135,80,"Line Properties"); dlg.addColLinePicker("VAL1",100,15,-1,-1,"Pivot Point","",colour1,pen1,width1); dlg.addColLinePicker("VAL2",100,35,-1,-1,"First Support/Resistance","",colour2,pen2,width2); dlg.addColLinePicker("VAL3",100,55,-1,-1,"Second Support/Resistance","",colour3,pen3,width3); dlg.addTickBox("VAL4",15,72,100,-1,"Draw into future",drawFuture); if (dlg.show() == Dialog.Cancel) return false; colour1 = dlg.getValue("VAL1").colour; pen1 = dlg.getValue("VAL1").pen; width1 = dlg.getValue("VAL1").width; colour2 = dlg.getValue("VAL2").colour; pen2 = dlg.getValue("VAL2").pen; width2 = dlg.getValue("VAL2").width; colour3 = dlg.getValue("VAL3").colour; pen3 = dlg.getValue("VAL3").pen; width3 = dlg.getValue("VAL3").width; drawFuture = dlg.getValue("VAL4"); } storage.setAt(0, pen1); storage.setAt(1, pen2); storage.setAt(2, pen3); storage.setAt(3, width1); storage.setAt(4, width2); storage.setAt(5, width3); storage.setAt(6, colour1); storage.setAt(7, colour2); storage.setAt(8, colour3); storage.setAt(9, drawFuture); } function onNewChart() { clearDisplay(); draw(); } function onNewBar() { clearDisplay(); draw(); } function draw() { var pivot=0; var res1=0; var res2=0; var sup1=0; var sup2=0; //DRAW PIVOT POINT LINE //sets the colour and style of the pen to draw the first line which is the pivot point line setPenStyle(pen1,width1,colour1); beginPath(); for (var i=1;i