//@Name:Price Oscillator Value //@Description:Returns the current value of the Price Oscillator. //@Returns:Number //@Width:75 //@Update:Periodic,15 //Coded by: Phil Tolhurst, ShareScript Support // 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 period1 = 10; var period2 = 20; var MAType1 = 0; var MAList = ["Simple","Exponential","Weighted","Triangular","VariableVHF","VariableCMO","VIDYA"]; var MATitleList = ["SMA","EMA","WMA","TMA","VHF","CMO","VIDYA"]; var dataSource = 0; var dataList = ["Daily","Weekly","Monthly"]; var useIntra = 0; function init(status) { if (status == Loading || status == Editing) { period1 = storage.getAt(0); period2 = storage.getAt(1); MAType1 = storage.getAt(2); dataSource = storage.getAt(3); useIntra = storage.getAt(4); } if (status == Adding || status == Editing) { dlg = new Dialog("Settings....", 275, 60); dlg.addOkButton(); dlg.addCancelButton(); dlg.addIntEdit("VAL1", 5, 5,-1, -1, "","and", period1, 1, 999); dlg.addIntEdit("VAL2", 55, 5,-1, -1, "","periods", period2, 1, 999); dlg.addDropList("VAL3",145,5,-1,-1, MAList, "MA Type","",MAType1); dlg.addDropList("VAL4",55,22,-1,-1, dataList,"Data Source:","",dataSource); dlg.addTickBox("VAL5",135,24,75,-1,"Use Intraday Data",useIntra); if (dlg.show()==Dialog.Cancel) return false; period1 = dlg.getValue("VAL1"); period2 = dlg.getValue("VAL2"); MAType1 = dlg.getValue("VAL3"); dataType = dlg.getValue("VAL4"); useIntra = dlg.getValue("VAL5"); storage.setAt(0, period1); storage.setAt(1, period2); storage.setAt(2, MAType1); storage.setAt(3, dataType); storage.setAt(4,useIntra); setTitle("PO Value: "+period1+"-"+period2+" "+MATitleList[MAType1]+" ("+(useIntra?"i":"")+dataList[dataType]+")"); } } function getVal(share) { var data = getData(share,dataSource,useIntra); var maCalc1 = new MA(period1,MAType1); var maCalc2 = new MA(period2,MAType1); var maRes1 = []; var maRes2 = []; if (data ==undefined || data.lengthdata[data.length-1].high?idata[0].high:data[data.length-1].high), low:(idata[0].lowdata[data.length-1].high?idata[0].high:data[data.length-1].high), low:(idata[0].low