//@Name:VHF Value //@Description:Returns the current value of the VHF Indicator //Returns:Number //@Width:100 //@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 = 20; var dataList = ["Daily","Weekly","Monthly"] var dataSource = 0; function init(status) { if (status == Loading || status == Editing) { period = storage.getAt(0); dataSource = storage.getAt(1); } if (status == Adding || status == Editing) { dlg = new Dialog("VHF Period", 160, 45); dlg.addOkButton(); dlg.addCancelButton(); dlg.addIntEdit("VAL1", 30, 5,-1, -1, "Period","", period, 1, 5000); dlg.addDropList("VAL2",30,23,-1,-1,dataList,"Source","",dataSource); if (dlg.show()==Dialog.Cancel) return false; period= dlg.getValue("VAL1"); dataSource = dlg.getValue("VAL2"); storage.setAt(0, period); storage.setAt(1,dataSource); } setTitle(period+" VHF ("+dataList[dataSource]+")"); } function getVal(share) { if (dataSource == 0 ) var data=share.getPriceArray(); else if (dataSource == 1 ) var data=share.getWeeklyBarArray(); else if (dataSource == 2 ) var data=share.getMonthlyBarArray(); var closeCalc = new MinMax(period); var HCP = []; var LCP = []; var numerator = []; var denCalc=[]; var denominator = []; var VHF= []; if (data.length<=period) return; for(var i=0;i