//@Name:Trading Profit //@Description:Trading Profit = Norm.Pre-Tax Profit - Interest Received - Rental Income + Interest Paid //@Returns:Number //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 yearsAgo = 0;; function init(status) { if (status == Loading || status == Editing) { yearsAgo = storage.getAt(0); } if (status == Adding || status == Editing) { dlg = new Dialog("Trading Profit", 150, 40); dlg.addOkButton(); dlg.addCancelButton(); dlg.addIntEdit("Val1",8,-1,-1,-1,"","Years Ago",yearsAgo); if (dlg.show()==Dialog.Cancel) return false; yearsAgo = dlg.getValue("Val1") storage.setAt(0, yearsAgo); } } function getVal(share) { var om = share.getResult(-yearsAgo, Result.OperatingMargin); var turn = share.getResult(-yearsAgo, Result.Turnover); return turn*(om/100); }