//@Name:TDSequential - Current Val //@Description:Shows the current value of the TD sequential indicator. //@Returns:Number //@Width:60 //Author: 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 dataList = ["Daily","Weekly","Monthly"]; var dataType = 0; function init(status) { if (status == Loading || status == Editing) { dataType = storage.getAt(0); } if (status == Adding || status == Editing) { dlg = new Dialog("Column Settings", 125, 45); dlg.addOkButton(); dlg.addCancelButton(); dlg.addDropList("VAL1",5,5,45,-1,dataList,"", "",dataType); if (dlg.show()==Dialog.Cancel) return false; dataType= dlg.getValue("VAL1"); storage.setAt(0, dataType); } } function getVal(share) { var priceFlip = 0; if (dataType==0)var data = share.getPriceArray(); if (dataType==1)var data = share.getWeeklyBarArray(); if (dataType==2)var data = share.getMonthlyBarArray(); if (data.length<10) return; for (var i=0;i data[i-4].close) { if (priceFlip>=0) priceFlip++; else priceFlip = 1; } if (data[i].close < data[i-4].close) { if (priceFlip<=0) priceFlip --; else priceFlip = -1 } } return priceFlip; }