[description=DJB - Display stats regarding share portfolio - use on daily data; category = DESB; author = Bleakley, Des ; target=PRICE; ] printposition := highest ( CLOSE, 10 ) *1.1; lastbar := barnumber = lastvalue( barnumber ); { **** Test for owned shares **** } sharebuycost1 := if ( security.symbol = "AGL", 20.942, if ( security.symbol = "ALL", 16.888, if ( security.symbol = "BAL", 10.929, if ( security.symbol = "BSL", 9.484, if ( security.symbol = "CBA", 77.095, if ( security.symbol = "CPU", 13.896, if ( security.symbol = "CSL", 120.98, if ( security.symbol = "DOW", 6.977, if ( security.symbol = "ELD", 4.395, if ( security.symbol = "GMG", 7.689, if ( security.symbol = "NHF", 5.33, if ( security.symbol = "QBE", 12.775, if ( security.symbol = "STL", 0.041, if ( security.symbol = "TLG", 0.383, if ( security.symbol = "WBC", 33.546, if ( security.symbol = "US.EWZ", 36.42, if ( security.symbol = "US.XLF", 23.38, if ( security.symbol = "US.FDX", 186.12, 0)))))))))))))))))); iownthis1 := sharebuycost1 > 0; [name = H1;color=blue;linestyle=solid;]; if(iownthis1, sharebuycost1, undefined); buydate1 := if( security.symbol = "AGL", date(2016,11,28), if( security.symbol = "ALL", date(2017,2,27), if( security.symbol = "BAL", date(2015,11,23), if( security.symbol = "BSL", date(2016,11,28), if( security.symbol = "CBA", date(2016,11,14), if( security.symbol = "CPU", date(2017,2,27), if( security.symbol = "CSL", date(2017,2,20), if( security.symbol = "DOW", date(2017,2,13), if( security.symbol = "ELD", date(2017, 2, 13), if( security.symbol = "GMG", date(2016,8,22), if( security.symbol = "NHF", date(2017,2,27), if( security.symbol = "QBE", date(2017,3,13), if( security.symbol = "STL", date(2016,6,20), if( security.symbol = "TLG", date(2014,8,30), if( security.symbol = "WBC", date(2017,2,13), 0))))))))))))))); [name="";color=blue;linestyle=verticalmarker]; iownthis1 AND buydate1=now(); numshares1 := if ( security.symbol = "AGL", 476, if ( security.symbol = "ALL", 1200, if ( security.symbol = "BAL", 67000, if ( security.symbol = "BSL", 4773, if ( security.symbol = "CBA", 2319, if ( security.symbol = "CPU", 20900, if ( security.symbol = "CSL", 170, if ( security.symbol = "DOW", 3000, if ( security.symbol = "ELD", 4700, if ( security.symbol = "GMG", 5000, if ( security.symbol = "NHF", 3700, if ( security.symbol = "QBE", 23100, if ( security.symbol = "STL", 400000, if ( security.symbol = "TLG", 210000, if ( security.symbol = "WBC", 8200, if ( security.symbol = "US.EWZ", 2000, if ( security.symbol = "US.XLF", 1550, if ( security.symbol = "US.FDX", 400, 0)))))))))))))))))); sharebuycost2 := if ( security.symbol = "AGL", 24.508, if ( security.symbol = "BSL", 12.501, if ( security.symbol = "CBA", 84.43,0))); iownthis2 := sharebuycost2 > 0; [name=H2;color=magenta;linestyle=line;]; if(iownthis2, sharebuycost2, undefined); buydate2 := if( security.symbol = "AGL", date(2017,2,20), if( security.symbol = "CBA", date(2017,2,13), if( security.symbol = "BSL", date(2017,2,20), 0))); [name="";color=magenta;linestyle=verticalmarker]; iownthis2 AND buydate2=now(); numshares2 := if ( security.symbol = "AGL", 524, if ( security.symbol = "BSL", 943, if ( security.symbol = "CBA", 1236, 0))); { **** Display share statistics **** } days1 := datediff( buydate1, now ); daysheld1 := if ( days1 =0,1, days1); Rdaysheld1 := round( if ( days1 =0,1, days1)); pricechange1 := CLOSE - sharebuycost1; pricechangepercent1 := (pricechange1 / sharebuycost1)*100; annualpricechangepercent1 := (pricechangepercent1 / daysheld1)*365; Rpricechangepercent1 := round ( pricechangepercent1,2); Rannualpricechangepercent1 := round( annualpricechangepercent1,0); buycost1 := round ( (numshares1*sharebuycost1) / 1000, 3 ); currentvalue1 := round ( (numshares1*CLOSE) / 1000, 3 ); profit1 := round(numshares1*CLOSE - numshares1*sharebuycost1); yesterdayclose1 := hist( CLOSE, 1); todaychange1 := CLOSE - yesterdayclose1; todaychangepc1 := round ( (todaychange1 / yesterdayclose1) * 100, 2); [name=own1;linestyle=text;textalign=below,centre;fontstyle=bold;fontsize=9;color=blue]; if ( iownthis1 AND lastbar ,security.symbol+" Buy Price : "+sharebuycost1+" Change : "+Rpricechangepercent1+"% in "+Rdaysheld1+" days = "+Rannualpricechangepercent1+"%PA - TODAY : "+todaychangepc1+"%", undefined); printposition; if ( iownthis1 AND lastbar ,"Num Shares : "+numshares1+" Value : $"+currentvalue1+"K Profit : $ "+profit1+" - ROC: "+round(ROC(C,126,%))+"%", undefined); printposition*0.98; days2 := datediff( buydate2, now ); daysheld2 := if ( days2 =0,1, days2); Rdaysheld2 := round( if ( days2 =0,1, days2)); pricechange2 := CLOSE - sharebuycost2; pricechangepercent2 := (pricechange2 / sharebuycost2)*100; annualpricechangepercent2 := (pricechangepercent2 / daysheld2)*365; Rpricechangepercent2 := round ( pricechangepercent2,2); Rannualpricechangepercent2 := round( annualpricechangepercent2,0); buycost2 := round ( (numshares2*sharebuycost2) / 1000, 3 ); currentvalue2 := round ( (numshares2*CLOSE) / 1000, 3 ); profit2 := round(numshares2*CLOSE - numshares2*sharebuycost2); yesterdayclose2 := hist( CLOSE, 1); todaychange2 := CLOSE - yesterdayclose2; todaychangepc2 := round ( (todaychange2 / yesterdayclose2) * 100, 2); [name=own2;linestyle=text;textalign=below,centre;fontstyle=bold;fontsize=9;color=magenta]; if ( iownthis2 AND lastbar ,security.symbol+" Buy Price : "+sharebuycost2+" Change : "+Rpricechangepercent2+"% in "+Rdaysheld2+" days = "+Rannualpricechangepercent2+"%PA - TODAY : "+todaychangepc2+"%", undefined); printposition*0.96; if ( iownthis2 AND lastbar ,"Num Shares : "+numshares2+" Value : $"+currentvalue2+"K Profit : $ "+profit2+" - ROC: "+round(ROC(C,126,%))+"%", undefined); printposition*0.94;