Deciding when to buying and sell stocks is difficult enough - figuring the profit or loss from that trade shouldn't have to be. Just enter the number of shares, your purchase price, your selling price, and the commission fees for the trade and this script instantly figures your resulting profit or loss after commission fees.
Add the below code to the <body> section of your page:
<scriptlanguage="javascript"type="text/javascript"> /* Visit http://www.yaldex.com/
for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin functionround(num){ amount =Math.round(num*Math.pow(10,2))/Math.pow(10,2); amount -=0; // .99 cent format courtsey of
Martin Webb return(amount
==Math.floor(amount))?
amount +'.00':((amount*10==Math.floor(amount*10))?
amount +'0':
amount);
}
function
dectable(){ windowprops ='personalbar=no,toolbar=no,'+ 'status=no,scrollbars=yes,location=no,'+ 'resizable=yes,menubar=no,width=340,height=400'; decimalWin=window.open('','table',
windowprops);
bought =round(parseFloat(shares
*
buyprice)+
buycomm);// price for purchase sold =round(parseFloat(shares
*
sellprice)-
sellcomm);// price sold for result =round(sold
-
bought);