tag:blogger.com,1999:blog-11583238781368773582023-06-20T21:38:30.555-07:00Bursa Profit Loss CalculatorPhilhttp://www.blogger.com/profile/17448379282758112615noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-1158323878136877358.post-26188286452668728402020-02-18T18:16:00.000-08:002019-07-15T02:20:56.903-07:00Bursa Profit Loss Calculator<center>
<h1>
Profit / Loss Calculator</h1>
</center>
<script language="JavaScript">
<!--
function summaryReport(qty, comm_type, bprice, sprice, clr_type, bcomm, scomm, stepdir,dprofit) {
if (qty == "") {
alert("Please enter No. of Shares");
document.form1.quantity.focus();
return false;
}
if (bprice == "") {
alert("Please enter Buy Price");
document.form1.b_price.focus();
return false;
}
if (bcomm == "") {
alert("Please enter Buy Brokerage Rate");
document.form1.b_comm.focus();
return false;
}
if (scomm == "") {
alert("Please enter Sell Brokerage Rate");
document.form1.s_comm.focus();
return false;
}
if ((sprice =="") && (dprofit=="")) {
alert("Please enter Sell Price or Desired Profit");
document.form1.s_price.focus();
return false;
}
if(isNaN(qty)) {
alert("No. of Shares must be a numeric");
document.form1.quantity.focus();
return false;
}
if(isNaN(bprice)) {
alert("Buy Price must be a numeric");
document.form1.b_price.focus();
return false;
}
if(isNaN(bcomm)) {
alert("Buy Brokerage Rate must be a numeric");
document.form1.b_comm.focus();
return false;
}
if(isNaN(scomm)) {
alert("Sell Brokerage Rate must be a numeric");
document.form1.s_comm.focus();
return false;
}
if(qty <= 0) {
alert("No. of Shares must be more than 0");
document.form1.quantity.focus();
return false;
}
if(bprice <= 0) {
alert("Buy Price must be more than 0");
document.form1.b_price.focus();
return false;
}
if(bcomm < 0) {
alert("Buy Brokerage Rate cannot be negative");
document.form1.b_comm.focus();
return false;
}
if(scomm < 0) {
alert("Sell Brokerage Rate cannot be negative");
document.form1.s_comm.focus();
return false;
}
if (sprice !="") {
if (isNaN(sprice)) {
alert("Sell Price must be a numeric");
document.form1.s_price.focus();
return false;
}
}
if (dprofit !="") {
if (isNaN(dprofit)) {
alert("Desired Profit must be a numeric");
document.form1.d_profit.focus();
return false;
}
}
if (sprice !="") {
if (sprice <= 0 ) {
alert("Sell Price must be more than 0");
document.form1.s_price.focus();
return false;
}
}
if (dprofit !="") {
if (dprofit <= 0) {
alert("Desired Profit must be more than 0");
document.form1.d_profit.focus();
return false;
}
}
if(qty != 0) {
if(bprice != 0) {
//if(sprice != 0) {
bnet = buyProceedCalc(qty, bprice, clr_type, bcomm, comm_type);
if (sprice != "") {
snet = sellProceedCalc(qty, sprice, clr_type, scomm, comm_type);
}
//} else if (dprofit != "") {
if (dprofit != "") {
rArray = dProfirProceedCalc(bnet,dprofit,qty,clr_type,scomm,comm_type);
snet = rArray[0];
sprice = rArray[1];
}
p_l = formatResult(snet) - formatResult(bnet);
/*if (p_l< 0){
p_l=p_l-0.01;
} else {
p_1=p_l+0.01;
}*/
document.getElementById("profit_loss").innerHTML = formatCurrency(p_l);
//this.form1.quantity.value = qty;
//this.form1.b_price.value = bprice;
//this.form1.s_price.value = sprice;
var kes = 'b_s';
breakEvenCalc(qty, bprice, comm_type, bcomm, scomm, clr_type);
autoStepComputation(qty, sprice, scomm, clr_type, stepdir, kes, bnet, comm_type);
/*} else {
cost = buyProceedCalc(qty, bprice, clr_type, bcomm, comm_type);
document.getElementById("sproceed").innerHTML = "- N.A. -";
document.getElementById("scomm").innerHTML = "- N.A. -";
document.getElementById("scfee").innerHTML = "- N.A. -";
document.getElementById("sstmp").innerHTML = "- N.A. -";
document.getElementById("snett").innerHTML = "- N.A. -";
document.getElementById("snettamt").innerHTML = "- N.A. -";
document.getElementById("profit_loss").innerHTML= "- N.A. -";
this.form1.quantity.value = qty;
this.form1.b_price.value = bprice;
var kes='b_only';
breakEvenCalc(qty, bprice, comm_type, bcomm, scomm, clr_type);
autoStepComputation(qty, bprice, bcomm, clr_type, step, stepdir, kes, cost, comm_type);
}*/
} else {
if(sprice!=0) {
cost = sellProceedCalc(qty, sprice, clr_type, scomm, comm_type);
document.getElementById("bproceed").innerHTML = "- N.A. -";
document.getElementById("bcomm").innerHTML = "- N.A. -";
document.getElementById("bcfee").innerHTML = "- N.A. -";
document.getElementById("bstmp").innerHTML = "- N.A. -";
document.getElementById("bnett").innerHTML = "- N.A. -";
document.getElementById("bnettamt").innerHTML = "- N.A. -";
document.getElementById("profit_loss").innerHTML= "- N.A. -";
this.form1.quantity.value = qty;
this.form1.s_price.value = sprice;
var kes='s_only';
document.getElementById("breakeven").innerHTML = "- N.A. -";
autoStepComputation(qty, sprice, scomm, clr_type, stepdir, kes, cost, comm_type);
} else {
alert("Please fill in the necessary fields in order to calculate the proceeds");
}
}
} else {
alert("Please fill in the necessary fields in order to calculate the proceeds");
}
}
function dProfirProceedCalc(bnet,dprofit,qty,clr_type,scomm,comm_type) {
var sell_gamt;
var s_stmp_duty;
var s_cfee;
var s_comm;
var s_nett_amt;
sellNet = parseFloat(bnet) + parseFloat(dprofit);
tempUnitPrice = dec3Round (sellNet/qty);
minBit = determineBit(tempUnitPrice);
tempUnitPrice = (parseFloat(tempUnitPrice) + parseFloat(minBit)) - ((((parseFloat(tempUnitPrice) + parseFloat(minBit)) * 100) % (parseFloat(minBit) * 100))/100);
cont = true;
while (cont == true) {
minBit = determineBit(tempUnitPrice);
sell_gamt = grossAmount(qty, tempUnitPrice);
if (comm_type=='1') {
s_stmp_duty = 0;
} else {
s_stmp_duty = stampDuty(sell_gamt,comm_type);
}
s_cfee = clrfeeCalc(sell_gamt, clr_type);
s_comm = commCalc(sell_gamt, scomm, comm_type);
s_nett_amt = sell_gamt - s_stmp_duty - s_cfee - s_comm;
if (parseFloat(s_nett_amt) > parseFloat(sellNet)) {
cont = false;
} else {
tempUnitPrice = (parseFloat(tempUnitPrice) + parseFloat(minBit));
tempUnitPrice = dec3Round (tempUnitPrice);
}
}
//document.form1.s_price.className='trivial'
var displayUnitPrice
position = tempUnitPrice.toString().indexOf(".");
tempHold = tempUnitPrice.toString().substr(position + 1);
if (tempHold.length == 1) {
displayUnitPrice = tempUnitPrice + "0";
} else {
displayUnitPrice = tempUnitPrice;
}
document.form1.s_price.value=displayUnitPrice;
document.getElementById("sproceed").innerHTML = formatCurrency(sell_gamt);
document.getElementById("scomm").innerHTML = formatCurrency(s_comm);
document.getElementById("scfee").innerHTML = formatCurrency(s_cfee);
document.getElementById("sstmp").innerHTML = formatCurrency(s_stmp_duty);
document.getElementById("snett").innerHTML = formatCurrency(s_nett_amt);
document.getElementById("snettamt").innerHTML = formatCurrency(s_nett_amt);
var rArray = new Array(2);
rArray[0] = s_nett_amt;
rArray[1] = tempUnitPrice;
return rArray;
}
function dec2Round (num1) {
num2 = Math.round(num1*100)/100;
return num2;
}
function dec3Round (num1) {
num2 = Math.round(num1*1000)/1000;
return num2;
}
function buyProceedCalc(qty, bprice, clr_type, bcomm, comm_type) {
buy_gamt = grossAmount(qty, bprice);
if (comm_type=='0'){
b_stmp_duty=0; b_cfee=0; b_comm=0;}
else {
if (comm_type=='1') {
b_stmp_duty = 0;
} else {
b_stmp_duty = stampDuty(buy_gamt,comm_type);
}
b_cfee = clrfeeCalc(buy_gamt, clr_type);
b_comm = commCalc(buy_gamt, bcomm, comm_type);
}
b_nett_amt = buy_gamt + b_stmp_duty + b_cfee + b_comm;
document.getElementById("bproceed").innerHTML = formatCurrency(buy_gamt);
document.getElementById("bcomm").innerHTML = formatCurrency(b_comm);
document.getElementById("bcfee").innerHTML = formatCurrency(b_cfee);
document.getElementById("bstmp").innerHTML = formatCurrency(b_stmp_duty);
document.getElementById("bnett").innerHTML = formatCurrency(b_nett_amt);
document.getElementById("bnettamt").innerHTML = formatCurrency(b_nett_amt);
return b_nett_amt;
}
function sellProceedCalc(qty, sprice, clr_type, scomm, comm_type){
sell_gamt = grossAmount(qty, sprice);
if (comm_type=='1') {
s_stmp_duty = 0;
} else {
s_stmp_duty = stampDuty(sell_gamt,comm_type);
}
s_cfee = clrfeeCalc(sell_gamt, clr_type);
s_comm = commCalc(sell_gamt, scomm, comm_type);
s_nett_amt = sell_gamt - s_stmp_duty - s_cfee - s_comm;
document.getElementById("sproceed").innerHTML = formatCurrency(sell_gamt);
document.getElementById("scomm").innerHTML = formatCurrency(s_comm);
document.getElementById("scfee").innerHTML = formatCurrency(s_cfee);
document.getElementById("sstmp").innerHTML = formatCurrency(s_stmp_duty);
document.getElementById("snett").innerHTML = formatCurrency(s_nett_amt);
document.getElementById("snettamt").innerHTML = formatCurrency(s_nett_amt);
return s_nett_amt;
}
function grossAmount(qty,price) {
g_amt = parseFloat(qty) * Math.round(parseFloat(price) * 10000);
return g_amt/10000;
}
function stampDuty(g_amt,comm_type) {
/*if(g_amt <= Math.round(g_amt)){
stmp_duty = Math.round(g_amt/1000);
if (stmp_duty < 1){
stmp_duty = 1.00;
} else {
stmp_duty =stmp_duty;
}
} else {*/
if (comm_type=='1') {
stmp_duty = 0;
} else {
stmp_duty = Math.ceil((g_amt/1000));
/*}*/
if (stmp_duty > 200) {
stmp_duty = 200;
}
}
return stmp_duty;
}
function clrfeeCalc(g_amt,cl_type) {
if(cl_type == 'om'){
c_fee = g_amt * 0.0003;
if(c_fee > 200){
c_fee = 200;
} else {
c_fee = c_fee;
}
return (Math.ceil(c_fee * 100)) /100 ;
} else {
max_cfee = 200;
min_cfee = 10;
tmp = g_amt * 0.0003;
if(tmp <= 10) {
return min_cfee;
} else {
if(tmp >= 200)
return max_cfee;
else
return (Math.round(tmp * 100))/100;
}
}
}
function commCalc(g_amt,comm,comm_type) {
if (comm_type =='1'){
commission = g_amt * comm * comm_type/100;
if (commission < 2.00) {
commission = 2.00;
}
} else {
commission = g_amt * comm * 1/100;
if (commission < 12.00) {
commission = 12.00;
}
}
return (Math.round(commission * 100))/100;
}
function incrementStep(price,step){
sum = price + step;
return sum;
}
function determineBit (price) {
var value = "0";
if (parseFloat(price) < 1)
value = "0.005";
else if ((parseFloat(price) >= 1) && (parseFloat(price) < 3))
value = "0.01";
else if ((parseFloat(price) >= 3) && (parseFloat(price) < 5))
value = "0.02";
else if ((parseFloat(price) >= 5) && (parseFloat(price) < 10))
value = "0.05";
else if ((parseFloat(price) >= 10) && (parseFloat(price) < 25))
value = "0.10";
else if ((parseFloat(price) >= 25) && (parseFloat(price) < 100))
value = "0.25";
else
value = "0.50";
return value;
}
function determineBitDecrement (price) {
var value = "0";
if (parseFloat(price) <= 1)
value = "0.005";
else if ((parseFloat(price) > 1) && (parseFloat(price) <= 3))
value = "0.01";
else if ((parseFloat(price) > 3) && (parseFloat(price) <= 5))
value = "0.02";
else if ((parseFloat(price) > 5) && (parseFloat(price) <= 10))
value = "0.05";
else if ((parseFloat(price) > 10) && (parseFloat(price) <= 25))
value = "0.10";
else if ((parseFloat(price) > 25) && (parseFloat(price) <= 100))
value = "0.25";
else
value = "0.50";
return value;
}
function formatCurrency(num) {
num = num.toString().replace(/$|\,/g,'');
if(isNaN(num))
num = "0";
//cents = Math.ceil((Math.abs(num)*100)%100);
cents = Math.ceil(dec2Round((Math.abs(num)*100)%100));
if (num > 0){
num = Math.floor((num*100)/100).toString();
} else {
num = Math.ceil((num*100)/100).toString();
}
if(cents < 10) cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
if(num>=0)
num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
else
if(num.length <=4)
num = num.substring(0,num.length-(4*i+3))+num.substring(num.length-(4*i+3));
else
num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
return (num + '.' + cents);
}
function formatResult(num) {
if(isNaN(num))
num = "0";
//cents = Math.ceil((Math.abs(num)*100)%100);
cents = Math.ceil(dec2Round((Math.abs(num)*100)%100));
if (num > 0){
num = Math.floor((num*100)/100).toString();
} else {
num = Math.ceil((num*100)/100).toString();
}
if(cents < 10)
cents = "0" + cents;
return (num + '.' + cents);
}
function formatCurrencyThreeDecimal(num) {
num = num.toString().replace(/$|\,/g,'');
if(isNaN(num)) num = "0";
if (num < Math.round(num)) {
newnum = num - 0.5;
absnewnum = Math.round(newnum);
}
else
absnewnum = Math.round(num);
var str = Math.abs(num-absnewnum) + 0.0005;
var srt = str.toString();
ss = srt.substring(1,5);
con = absnewnum + ss;
return con;
}
function formatBreakEven(num) {
num = num.toString().replace(/$|\,/g,'');
if(isNaN(num)) num = "0";
if (num < Math.round(num))
{
newnum = num - 0.5;
absnewnum = Math.round(newnum);
}
else
absnewnum = Math.round(num);
var str = Math.abs(num-absnewnum);
var srt = str.toString();
ss = srt.substring(1,5);
con = absnewnum + ss;
return con;
}
/* function breakEvenCalc(qty, bprice,comm_type,bcomm,scomm){
if(comm_type =='1')
breven = ((1.0014+bcomm/100)/(0.9986-scomm/100))*bprice + 0.002;
else{
breven = (1.0014/(0.9986-scomm/100))*bprice + 0.002;
}
document.getElementById("breakeven").innerHTML = formatBreakEven(breven);
return;
}*/
function breakEvenCalc(qty, bprice,comm_type,bcomm,scomm, clr_type){
buy_gamt = grossAmount(qty, bprice);
b_stmp_duty = stampDuty(buy_gamt,comm_type);
b_cfee = clrfeeCalc(buy_gamt, clr_type);
b_comm = commCalc(buy_gamt, bcomm, comm_type);
b_nett_amt = buy_gamt+(2*b_stmp_duty)+(2*b_cfee)+(2*b_comm);
if(comm_type =='1' || comm_type =='2' )
breven = ((b_nett_amt/qty)+0.0016) ;
else{
breven = (((buy_gamt+b_stmp_duty+b_cfee+b_comm)/qty)+0.0015);
}
document.getElementById("breakeven").innerHTML = formatBreakEven(breven);
return;
}
function sellCalc(qty, sprice, clr_type, scomm, comm_type){
sell_gamt = grossAmount(qty, sprice);
s_stmp_duty = stampDuty(sell_gamt,comm_type);
s_cfee = clrfeeCalc(sell_gamt, clr_type);
s_comm = commCalc(sell_gamt, scomm, comm_type);
s_nett_amt = sell_gamt - s_stmp_duty - s_cfee - s_comm;
return s_nett_amt;
}
function autoStepComputation(qty, price, comm, cfee, stepsign, ks, cost, comm_type) {
var priceArr = new Array();
var netAmtArr = new Array();
var plArr = new Array();
priceArr[0] = price;
netAmtArr[0] = sellCalc(qty, price, cfee, comm, comm_type);
plArr[0] = netAmtArr[0] - cost;
//if(stepsign == 'd')
// step = step * (-1);
pr = parseFloat(price);
//st = parseFloat(step);
switch(ks) {
/*
case 'b_only':
for(var i = 1; i <= 10; i++) {
pr = incrementStep(pr, st);
priceArr[i] = formatCurrencyThreeDecimal(pr);
netAmtArr[i] = sellCalc(qty, pr, cfee, comm, comm_type);
plArr[i] = netAmtArr[i] - cost;
}
document.getElementById("txt0").innerHTML = formatCurrencyThreeDecimal(priceArr[0]);
document.getElementById("sp0").innerHTML = formatCurrency(netAmtArr[0]);
document.getElementById("pl0").innerHTML = formatCurrency(plArr[0]);
document.getElementById("txt1").innerHTML = priceArr[1];
document.getElementById("sp1").innerHTML = formatCurrency(netAmtArr[1]);
document.getElementById("pl1").innerHTML = formatCurrency(plArr[1]);
document.getElementById("txt2").innerHTML = priceArr[2];
document.getElementById("sp2").innerHTML = formatCurrency(netAmtArr[2]);
document.getElementById("pl2").innerHTML = formatCurrency(plArr[2]);
document.getElementById("txt3").innerHTML = priceArr[3];
document.getElementById("sp3").innerHTML = formatCurrency(netAmtArr[3]);
document.getElementById("pl3").innerHTML = formatCurrency(plArr[3]);
document.getElementById("txt4").innerHTML = priceArr[4];
document.getElementById("sp4").innerHTML = formatCurrency(netAmtArr[4]);
document.getElementById("pl4").innerHTML = formatCurrency(plArr[4]);
document.getElementById("txt5").innerHTML = priceArr[5];
document.getElementById("sp5").innerHTML = formatCurrency(netAmtArr[5]);
document.getElementById("pl5").innerHTML = formatCurrency(plArr[5]);
document.getElementById("txt6").innerHTML = priceArr[6];
document.getElementById("sp6").innerHTML = formatCurrency(netAmtArr[6]);
document.getElementById("pl6").innerHTML = formatCurrency(plArr[6]);
document.getElementById("txt7").innerHTML = priceArr[7];
document.getElementById("sp7").innerHTML = formatCurrency(netAmtArr[7]);
document.getElementById("pl7").innerHTML = formatCurrency(plArr[7]);
document.getElementById("txt8").innerHTML = priceArr[8];
document.getElementById("sp8").innerHTML = formatCurrency(netAmtArr[8]);
document.getElementById("pl8").innerHTML = formatCurrency(plArr[8]);
document.getElementById("txt9").innerHTML = priceArr[9];
document.getElementById("sp9").innerHTML = formatCurrency(netAmtArr[9]);
document.getElementById("pl9").innerHTML = formatCurrency(plArr[9]);
document.getElementById("txt10").innerHTML = priceArr[10];
document.getElementById("sp10").innerHTML = formatCurrency(netAmtArr[10]);
document.getElementById("pl10").innerHTML = formatCurrency(plArr[10]);
break;
case 's_only':
plArr[0] = "- N.A. -";
for(var j = 1; j <= 10; j++){
pr = incrementStep(pr, st);
priceArr[j] = formatCurrencyThreeDecimal(pr);
netAmtArr[j] = formatCurrency(sellCalc(qty, pr, cfee, comm, comm_type));
plArr[j] = "- N.A. -";
}
document.getElementById("txt0").innerHTML = formatCurrencyThreeDecimal(priceArr[0]);
document.getElementById("sp0").innerHTML = formatCurrency(netAmtArr[0]);
document.getElementById("pl0").innerHTML = plArr[0];
document.getElementById("txt1").innerHTML = priceArr[1];
document.getElementById("sp1").innerHTML = netAmtArr[1];
document.getElementById("pl1").innerHTML = plArr[1];
document.getElementById("txt2").innerHTML = priceArr[2];
document.getElementById("sp2").innerHTML = netAmtArr[2];
document.getElementById("pl2").innerHTML = plArr[2];
document.getElementById("txt3").innerHTML = priceArr[3];
document.getElementById("sp3").innerHTML = netAmtArr[3];
document.getElementById("pl3").innerHTML = plArr[3];
document.getElementById("txt4").innerHTML = priceArr[4];
document.getElementById("sp4").innerHTML = netAmtArr[4];
document.getElementById("pl4").innerHTML = plArr[4];
document.getElementById("txt5").innerHTML = priceArr[5];
document.getElementById("sp5").innerHTML = netAmtArr[5];
document.getElementById("pl5").innerHTML = plArr[5];
document.getElementById("txt6").innerHTML = priceArr[6];
document.getElementById("sp6").innerHTML = netAmtArr[6];
document.getElementById("pl6").innerHTML = plArr[6];
document.getElementById("txt7").innerHTML = priceArr[7];
document.getElementById("sp7").innerHTML = netAmtArr[7];
document.getElementById("pl7").innerHTML = plArr[7];
document.getElementById("txt8").innerHTML = priceArr[8];
document.getElementById("sp8").innerHTML = netAmtArr[8];
document.getElementById("pl8").innerHTML = plArr[8];
document.getElementById("txt9").innerHTML = priceArr[9];
document.getElementById("sp9").innerHTML = netAmtArr[9];
document.getElementById("pl9").innerHTML = plArr[9];
document.getElementById("txt10").innerHTML = priceArr[10];
document.getElementById("sp10").innerHTML = netAmtArr[10];
document.getElementById("pl10").innerHTML = plArr[10];
break;
*/
case 'b_s':
for(var k=1; k<=10; k++){
pr = dec3Round(pr);
if (stepsign == 'i') {
minBit = determineBit(pr);
if (k ==1) {
//alert((parseFloat(pr) + parseFloat(minBit)) * 100);
pr = (parseFloat(pr) + parseFloat(minBit)) - ((dec3Round(((parseFloat(pr) + parseFloat(minBit)) * 100)) % (parseFloat(minBit) * 100))/100);
//pr = (parseFloat(pr) + parseFloat(minBit)) - ((((pr + minBit) * 100) % (minBit * 100))/100);
} else {
pr = (parseFloat(pr) + parseFloat(minBit));
}
} else {
minBitDecrement = determineBitDecrement(pr);
if (k == 1) {
minBit = determineBit(pr);
holder = (dec3Round(((parseFloat(pr) + parseFloat(minBit)) * 100)) % (parseFloat(minBit) * 100))/100;
pr = dec3Round(parseFloat(pr)) - ((dec3Round(((parseFloat(pr) + parseFloat(minBit)) * 100)) % (parseFloat(minBit) * 100))/100);
minBitDecrement = determineBitDecrement(pr);
if (holder == 0) {
pr = dec3Round((parseFloat(pr) - parseFloat(minBitDecrement)));
}
} else {
minBitDecrement = determineBitDecrement(pr);
pr = dec3Round((parseFloat(pr) - parseFloat(minBitDecrement)));
}
}
//pr = incrementStep(pr, st);
priceArr[k] = pr;
netAmtArr[k] = sellCalc(qty, pr, cfee, comm, comm_type);
//plArr[k] = (Math.ceil(parseFloat(netAmtArr[k])*100) /100) - (Math.ceil(parseFloat(cost)*100) /100);
plArr[k] = formatResult(netAmtArr[k]) - formatResult(cost);
}
document.getElementById("txt0").innerHTML = formatCurrencyThreeDecimal(priceArr[0]);
document.getElementById("sp0").innerHTML = formatCurrency(netAmtArr[0]);
document.getElementById("pl0").innerHTML = formatCurrency(plArr[0]);
document.getElementById("txt1").innerHTML = formatCurrencyThreeDecimal(priceArr[1]);
document.getElementById("sp1").innerHTML = formatCurrency(netAmtArr[1]);
document.getElementById("pl1").innerHTML = formatCurrency(plArr[1]);
document.getElementById("txt2").innerHTML = formatCurrencyThreeDecimal(priceArr[2]);
document.getElementById("sp2").innerHTML = formatCurrency(netAmtArr[2]);
document.getElementById("pl2").innerHTML = formatCurrency(plArr[2]);
document.getElementById("txt3").innerHTML = formatCurrencyThreeDecimal(priceArr[3]);
document.getElementById("sp3").innerHTML = formatCurrency(netAmtArr[3]);
document.getElementById("pl3").innerHTML = formatCurrency(plArr[3]);
document.getElementById("txt4").innerHTML = formatCurrencyThreeDecimal(priceArr[4]);
document.getElementById("sp4").innerHTML = formatCurrency(netAmtArr[4]);
document.getElementById("pl4").innerHTML = formatCurrency(plArr[4]);
document.getElementById("txt5").innerHTML = formatCurrencyThreeDecimal(priceArr[5]);
document.getElementById("sp5").innerHTML = formatCurrency(netAmtArr[5]);
document.getElementById("pl5").innerHTML = formatCurrency(plArr[5]);
document.getElementById("txt6").innerHTML = formatCurrencyThreeDecimal(priceArr[6]);
document.getElementById("sp6").innerHTML = formatCurrency(netAmtArr[6]);
document.getElementById("pl6").innerHTML = formatCurrency(plArr[6]);
document.getElementById("txt7").innerHTML = formatCurrencyThreeDecimal(priceArr[7]);
document.getElementById("sp7").innerHTML = formatCurrency(netAmtArr[7]);
document.getElementById("pl7").innerHTML = formatCurrency(plArr[7]);
document.getElementById("txt8").innerHTML = formatCurrencyThreeDecimal(priceArr[8]);
document.getElementById("sp8").innerHTML = formatCurrency(netAmtArr[8]);
document.getElementById("pl8").innerHTML = formatCurrency(plArr[8]);
document.getElementById("txt9").innerHTML = formatCurrencyThreeDecimal(priceArr[9]);
document.getElementById("sp9").innerHTML = formatCurrency(netAmtArr[9]);
document.getElementById("pl9").innerHTML = formatCurrency(plArr[9]);
break;
}
}
function resetForm(){
document.getElementById("bproceed").innerHTML = "0.00";
document.getElementById("bcomm").innerHTML = "0.00";
document.getElementById("bcfee").innerHTML = "0.00";
document.getElementById("bstmp").innerHTML = "0.00";
document.getElementById("bnett").innerHTML = "0.00";
document.getElementById("bnettamt").innerHTML = "0.00";
document.getElementById("sproceed").innerHTML = "0.00";
document.getElementById("scomm").innerHTML = "0.00";
document.getElementById("scfee").innerHTML = "0.00";
document.getElementById("sstmp").innerHTML = "0.00";
document.getElementById("snett").innerHTML = "0.00";
document.getElementById("snettamt").innerHTML = "0.00";
document.getElementById("breakeven").innerHTML = "0.00";
document.getElementById("profit_loss").innerHTML= "0.00";
document.getElementById("txt0").innerHTML = "0.00";
document.getElementById("sp0").innerHTML = "0.00";
document.getElementById("pl0").innerHTML = "0.00";
document.getElementById("txt1").innerHTML = "0.00";
document.getElementById("sp1").innerHTML = "0.00";
document.getElementById("pl1").innerHTML = "0.00";
document.getElementById("txt2").innerHTML = "0.00";
document.getElementById("sp2").innerHTML = "0.00";
document.getElementById("pl2").innerHTML = "0.00";
document.getElementById("txt3").innerHTML = "0.00";
document.getElementById("sp3").innerHTML = "0.00";
document.getElementById("pl3").innerHTML = "0.00";
document.getElementById("txt4").innerHTML = "0.00";
document.getElementById("sp4").innerHTML = "0.00";
document.getElementById("pl4").innerHTML = "0.00";
document.getElementById("txt5").innerHTML = "0.00";
document.getElementById("sp5").innerHTML = "0.00";
document.getElementById("pl5").innerHTML = "0.00";
document.getElementById("txt6").innerHTML = "0.00";
document.getElementById("sp6").innerHTML = "0.00";
document.getElementById("pl6").innerHTML = "0.00";
document.getElementById("txt7").innerHTML = "0.00";
document.getElementById("sp7").innerHTML = "0.00";
document.getElementById("pl7").innerHTML = "0.00";
document.getElementById("txt8").innerHTML = "0.00";
document.getElementById("sp8").innerHTML = "0.00";
document.getElementById("pl8").innerHTML = "0.00";
document.getElementById("txt9").innerHTML = "0.00";
document.getElementById("sp9").innerHTML = "0.00";
document.getElementById("pl9").innerHTML = "0.00";
document.form1.b_comm.value="0.42";
document.form1.s_comm.value="0.42";
document.form1.b_price.value="";
document.form1.s_price.value="";
document.form1.d_profit.value="";
document.form1.quantity.value="";
document.form1.s_price.disabled = false;
document.form1.d_profit.disabled = false;
}
function disableSell() {
if (document.form1.d_profit.value != "") {
document.form1.s_price.disabled = true;
document.form1.s_price.value="";
} else {
document.form1.s_price.disabled = false;
}
}
function disableDProfit() {
if (document.form1.s_price.value != "") {
document.form1.d_profit.disabled = true;
} else {
document.form1.d_profit.disabled = false;
}
}
//-->
</script>
<script language="JavaScript"><!--
function timer() {
setTimeout("parent.main.location.href='/IST/demand.jsp?callingPage=/IST/StockCalculator.jsp'",270000);
}
function refreshFrame() {
parent.dummyframe.location.href='/mbb/scripts/dummy.jsp?BV_SessionID=@@@@1694685007.1163560345@@@@&BV_EngineID=ccddaddjgiijffecflgcehfdfkgdgij.0';
}
refreshFrame();
//--></script>
<br />
<form name="form1">
<table border="0" cellpadding="0" cellspacing="2" style="width: 100%px;">
<tbody>
<tr>
<td height="18" valign="top">Enter the details and click on the <i>compute</i>
button to find out if you are making a <i>profit</i> or a <i>loss</i>.
</td>
</tr>
<tr bgcolor="#FA6900">
<td bgcolor="#FA6900" height="16"><span style="color: black;"><b> Contract Details</b></span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td><table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td height="20" width="8%"></td>
<td align="center" width="23%"><span style="color: black;">No of Shares</span></td>
<td align="center" width="23%"><span style="color: black;">Price (RM)</span></td>
<td align="center" width="23%"><span style="color: black;">Brokerage Rate</span></td>
<td align="center" width="23%"><span style="color: black;">Desired Profit</span></td>
</tr>
<tr>
<td align="center"><span style="color: black;">Buy</span></td>
<td align="center"><input maxlength="8" name="quantity" size="8" /></td>
<td align="center"><input maxlength="6" name="b_price" size="6" /></td>
<td align="center"><input maxlength="6" name="b_comm" size="6" value="0.42" /></td>
<td align="center"><input maxlength="10" name="d_profit" onblur="disableSell(); return false" size="10" /></td>
</tr>
<tr>
<td align="center"><span style="color: black;">Sell</span></td>
<td></td>
<td align="center"><input maxlength="6" name="s_price" onblur="disableDProfit(); return false" size="6" /></td>
<td align="center"><input maxlength="6" name="s_comm" size="6" value="0.42" /></td>
<td></td>
</tr>
<tr>
<td colspan="4" height="2"></td>
</tr>
</tbody></table>
</td>
</tr>
<tr bgcolor="#EBF2F9">
<td align="center" height="22" valign="bottom"><table border="0" cellpadding="1" cellspacing="0">
<tbody>
<tr>
<td><input onclick="summaryReport(document.form1.quantity.value,document.form1.comm_type.value,document.form1.b_price.value,document.form1.s_price.value,document.form1.clr_fee.value,document.form1.b_comm.value,document.form1.s_comm.value,document.form1.step_dir.value,document.form1.d_profit.value); return false" type="button" value="Compute" /></td>
<td width="10"></td>
<td><input onclick="resetForm(); return false" type="button" value=" Reset " /></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<hr size="1" width="100%" />
<table align="center" border="0" cellpadding="1" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td valign="top" width="5%"><table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td height="16"><span style="font-weight: bold;"><span style="font-style: italic;">Contract Type</span></span></td>
</tr>
<tr>
<td height="16">Share Bought From:</td>
</tr>
<tr>
<td><select name="comm_type" onchange="summaryReport(document.form1.quantity.value,document.form1.comm_type.value,document.form1.b_price.value,document.form1.s_price.value,document.form1.clr_fee.value,document.form1.b_comm.value,document.form1.s_comm.value,document.form1.step_dir.value,document.form1.d_profit.value); return false">
<option value="2">Existing KLSE contracts - Non Loan
</option><option value="1">Existing KLSE contracts - Loan
</option><option value="0">IPO / no brokerage contracts
</option></select>
</td>
</tr>
<tr>
<td>Clearing Fee For: </td>
</tr>
<tr>
<td><select name="clr_fee" onchange="summaryReport(document.form1.quantity.value,document.form1.comm_type.value,document.form1.b_price.value,document.form1.s_price.value,document.form1.clr_fee.value,document.form1.b_comm.value,document.form1.s_comm.value,document.form1.step_dir.value,document.form1.d_profit.value); return false">
<option value="om">On-Market
</option><option value="db">Direct Business
</option></select>
</td>
</tr>
</tbody></table>
</td>
<td width="95%"><table border="0" cellpadding="0" cellspacing="2" style="width: 100%px;">
<tbody>
<tr bgcolor="#FA6900">
<td bgcolor="#FA6900" height="16"><span style="color: black;"><b> Results</b></span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td><table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td height="14"><span style="color: black;"> Details</span></td>
<td align="right"><span style="color: black;">Buy </span></td>
<td align="right"><span style="color: black;">Sell </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Proceeds</span></td>
<td align="right"><span style="color: black;"><span id="bproceed">0.00</span> </span></td>
<td align="right"><span style="color: black;"><span id="sproceed">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Brokerage Fee</span></td>
<td align="right"><span style="color: black;"><span id="bcomm">0.00</span> </span></td>
<td align="right"><span style="color: black;"><span id="scomm">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Clearing Fee</span></td>
<td align="right"><span style="color: black;"><span id="bcfee">0.00</span> </span></td>
<td align="right"><span style="color: black;"><span id="scfee">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Stamp Duty</span></td>
<td align="right"><span style="color: black;"><span id="bstmp">0.00</span> </span></td>
<td align="right"><span style="color: black;"><span id="sstmp">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"> <b><span style="color: black;"><b>Net Amount</b></span></b></td>
<td align="right"><span style="color: black;"><b><span id="bnett">0.00</span> </b></span></td>
<td align="right"><span style="color: black;"><b><span id="snett">0.00</span> </b></span></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<table border="0" cellpadding="0" cellspacing="2" style="width: 100%px;">
<tbody>
<tr bgcolor="#FA6900">
<td bgcolor="#FA6900" height="16"><span style="color: black;"><b> Summary</b></span></td>
</tr>
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Breakeven Price</span></td>
<td align="right"><span style="color: black;"><span id="breakeven">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Buy Net Amount</span></td>
<td align="right"><span style="color: black;"><span id="bnettamt">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Sell Net Amount</span></td>
<td align="right"><span style="color: black;"><span id="snettamt">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> <b>Profit/Loss</b></span></td>
<td align="right"><span style="color: black;"><b><span id="profit_loss">0.00</span> </b></span></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<hr size="1" width="100%" />
<table align="center" border="0" cellpadding="1" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td valign="top" width="5%"><table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td colspan="2"><span style="font-weight: bold;"><span style="font-style: italic;">Price Range Index</span></span></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2" height="16">Stepping Method:</td>
</tr>
<tr>
<td colspan="2"><select name="step_dir" onchange="summaryReport(document.form1.quantity.value,document.form1.comm_type.value,document.form1.b_price.value,document.form1.s_price.value,document.form1.clr_fee.value,document.form1.b_comm.value,document.form1.s_comm.value,document.form1.step_dir.value,document.form1.d_profit.value); return false">
<option value="i">Increment
</option><option value="d">Decrement
</option></select>
</td>
</tr>
</tbody></table>
</td>
<td width="95%"><table border="0" cellpadding="0" cellspacing="2" style="width: 100%px;">
<tbody>
<tr bgcolor="#FA6900">
<td bgcolor="#FA6900" height="16"><span style="color: black;"><b> Auto Computation (Profit/Loss)</b></span></td>
</tr>
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;">Sell Price </span></td>
<td><span style="color: black;">Net Amount </span></td>
<td><span style="color: black;">Profit/Loss </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt0">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp0">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl0">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt1">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp1">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl1">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt2">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp2">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl2">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt3">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp3">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl3">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt4">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp4">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl4">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt5">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp5">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl5">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt6">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp6">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl6">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt7">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp7">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl7">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt8">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp8">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl8">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt9">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp9">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl9">0.00</span> </span></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</form>
How to use Bursa Profit Loss Calculator:<br />
<br />
1. Enter Number of Share<br />
<br />
2. Enter Buy Price<br />
<br />
3. Enter Sell Price<br />
<br />
4. Enter Brokerage Fee (default = 0.42%, you can change to you own brokerage fee)<br />
<br />
5. Press Compute<br />
<br />
6. You can also enter desired profit. For this, you do not need to enter sell price. When you click compute, the "Buy Price" box will show the price to sell to get your desired profit.<br />
<br />
Thank you for using Bursa Profit Loss CalculatorPhilhttp://www.blogger.com/profile/17448379282758112615noreply@blogger.comtag:blogger.com,1999:blog-1158323878136877358.post-14062909860107740982011-04-14T03:48:00.001-07:002011-04-14T03:48:58.019-07:00The Basic Conversion for Soyoil and CPO Futures<div style="margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: Verdana; font-size: xx-small;">Here is the basic conversion for soybean oil futures and crude palm oil futures ( CPO ) in US Dollar term:<br />
<br />
<b>Soyoil Price per pound</b> x <b>2204.622</b> = <b>Soyoil Price per metric ton</b> , or<br />
<br />
<b>CPO Price metric ton</b> x <b>0.0004536</b> = <b>CPO Price per pound</b>.<br />
<br />
For example, 50cents soyoil futures price with contract specification of 60,000 pounds is:</span></div><div align="center" style="margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: Verdana; font-size: xx-small;"> <b>$0.50 x 2204.622 =$1,102.3 per metric ton as in USD</b></span></div><div align="left" style="margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: Verdana; font-size: xx-small;">If CPO Futures price RM3,000 per metric ton and currency USD/MYR is at 3.00, then:</span></div><div align="center" style="margin-bottom: 0pt; margin-top: 0pt;"><b><span style="font-family: Verdana; font-size: xx-small;">MYR3,000 / 3 = $1,000 per metric ton as in USD</span></b></div><div align="left" style="margin-bottom: 0pt; margin-top: 0pt;"><span style="font-family: Verdana; font-size: xx-small;">Therefore, the price discrepancy (premium/discount) for soybean oil futures and crude palm oil futures in both exchanges (CME and BMD) can be easily followed up.</span></div>Philhttp://www.blogger.com/profile/17448379282758112615noreply@blogger.comtag:blogger.com,1999:blog-1158323878136877358.post-52816581023252952532011-04-06T09:10:00.000-07:002019-07-15T02:22:03.131-07:00KLSE Stocks Profit Loss Calculator<center>
<h1>
Profit / Loss Calculator</h1>
</center>
<script language="JavaScript">
<!--
function summaryReport(qty, comm_type, bprice, sprice, clr_type, bcomm, scomm, stepdir,dprofit) {
if (qty == "") {
alert("Please enter No. of Shares");
document.form1.quantity.focus();
return false;
}
if (bprice == "") {
alert("Please enter Buy Price");
document.form1.b_price.focus();
return false;
}
if (bcomm == "") {
alert("Please enter Buy Brokerage Rate");
document.form1.b_comm.focus();
return false;
}
if (scomm == "") {
alert("Please enter Sell Brokerage Rate");
document.form1.s_comm.focus();
return false;
}
if ((sprice =="") && (dprofit=="")) {
alert("Please enter Sell Price or Desired Profit");
document.form1.s_price.focus();
return false;
}
if(isNaN(qty)) {
alert("No. of Shares must be a numeric");
document.form1.quantity.focus();
return false;
}
if(isNaN(bprice)) {
alert("Buy Price must be a numeric");
document.form1.b_price.focus();
return false;
}
if(isNaN(bcomm)) {
alert("Buy Brokerage Rate must be a numeric");
document.form1.b_comm.focus();
return false;
}
if(isNaN(scomm)) {
alert("Sell Brokerage Rate must be a numeric");
document.form1.s_comm.focus();
return false;
}
if(qty <= 0) {
alert("No. of Shares must be more than 0");
document.form1.quantity.focus();
return false;
}
if(bprice <= 0) {
alert("Buy Price must be more than 0");
document.form1.b_price.focus();
return false;
}
if(bcomm < 0) {
alert("Buy Brokerage Rate cannot be negative");
document.form1.b_comm.focus();
return false;
}
if(scomm < 0) {
alert("Sell Brokerage Rate cannot be negative");
document.form1.s_comm.focus();
return false;
}
if (sprice !="") {
if (isNaN(sprice)) {
alert("Sell Price must be a numeric");
document.form1.s_price.focus();
return false;
}
}
if (dprofit !="") {
if (isNaN(dprofit)) {
alert("Desired Profit must be a numeric");
document.form1.d_profit.focus();
return false;
}
}
if (sprice !="") {
if (sprice <= 0 ) {
alert("Sell Price must be more than 0");
document.form1.s_price.focus();
return false;
}
}
if (dprofit !="") {
if (dprofit <= 0) {
alert("Desired Profit must be more than 0");
document.form1.d_profit.focus();
return false;
}
}
if(qty != 0) {
if(bprice != 0) {
//if(sprice != 0) {
bnet = buyProceedCalc(qty, bprice, clr_type, bcomm, comm_type);
if (sprice != "") {
snet = sellProceedCalc(qty, sprice, clr_type, scomm, comm_type);
}
//} else if (dprofit != "") {
if (dprofit != "") {
rArray = dProfirProceedCalc(bnet,dprofit,qty,clr_type,scomm,comm_type);
snet = rArray[0];
sprice = rArray[1];
}
p_l = formatResult(snet) - formatResult(bnet);
/*if (p_l< 0){
p_l=p_l-0.01;
} else {
p_1=p_l+0.01;
}*/
document.getElementById("profit_loss").innerHTML = formatCurrency(p_l);
//this.form1.quantity.value = qty;
//this.form1.b_price.value = bprice;
//this.form1.s_price.value = sprice;
var kes = 'b_s';
breakEvenCalc(qty, bprice, comm_type, bcomm, scomm, clr_type);
autoStepComputation(qty, sprice, scomm, clr_type, stepdir, kes, bnet, comm_type);
/*} else {
cost = buyProceedCalc(qty, bprice, clr_type, bcomm, comm_type);
document.getElementById("sproceed").innerHTML = "- N.A. -";
document.getElementById("scomm").innerHTML = "- N.A. -";
document.getElementById("scfee").innerHTML = "- N.A. -";
document.getElementById("sstmp").innerHTML = "- N.A. -";
document.getElementById("snett").innerHTML = "- N.A. -";
document.getElementById("snettamt").innerHTML = "- N.A. -";
document.getElementById("profit_loss").innerHTML= "- N.A. -";
this.form1.quantity.value = qty;
this.form1.b_price.value = bprice;
var kes='b_only';
breakEvenCalc(qty, bprice, comm_type, bcomm, scomm, clr_type);
autoStepComputation(qty, bprice, bcomm, clr_type, step, stepdir, kes, cost, comm_type);
}*/
} else {
if(sprice!=0) {
cost = sellProceedCalc(qty, sprice, clr_type, scomm, comm_type);
document.getElementById("bproceed").innerHTML = "- N.A. -";
document.getElementById("bcomm").innerHTML = "- N.A. -";
document.getElementById("bcfee").innerHTML = "- N.A. -";
document.getElementById("bstmp").innerHTML = "- N.A. -";
document.getElementById("bnett").innerHTML = "- N.A. -";
document.getElementById("bnettamt").innerHTML = "- N.A. -";
document.getElementById("profit_loss").innerHTML= "- N.A. -";
this.form1.quantity.value = qty;
this.form1.s_price.value = sprice;
var kes='s_only';
document.getElementById("breakeven").innerHTML = "- N.A. -";
autoStepComputation(qty, sprice, scomm, clr_type, stepdir, kes, cost, comm_type);
} else {
alert("Please fill in the necessary fields in order to calculate the proceeds");
}
}
} else {
alert("Please fill in the necessary fields in order to calculate the proceeds");
}
}
function dProfirProceedCalc(bnet,dprofit,qty,clr_type,scomm,comm_type) {
var sell_gamt;
var s_stmp_duty;
var s_cfee;
var s_comm;
var s_nett_amt;
sellNet = parseFloat(bnet) + parseFloat(dprofit);
tempUnitPrice = dec3Round (sellNet/qty);
minBit = determineBit(tempUnitPrice);
tempUnitPrice = (parseFloat(tempUnitPrice) + parseFloat(minBit)) - ((((parseFloat(tempUnitPrice) + parseFloat(minBit)) * 100) % (parseFloat(minBit) * 100))/100);
cont = true;
while (cont == true) {
minBit = determineBit(tempUnitPrice);
sell_gamt = grossAmount(qty, tempUnitPrice);
if (comm_type=='1') {
s_stmp_duty = 0;
} else {
s_stmp_duty = stampDuty(sell_gamt,comm_type);
}
s_cfee = clrfeeCalc(sell_gamt, clr_type);
s_comm = commCalc(sell_gamt, scomm, comm_type);
s_nett_amt = sell_gamt - s_stmp_duty - s_cfee - s_comm;
if (parseFloat(s_nett_amt) > parseFloat(sellNet)) {
cont = false;
} else {
tempUnitPrice = (parseFloat(tempUnitPrice) + parseFloat(minBit));
tempUnitPrice = dec3Round (tempUnitPrice);
}
}
//document.form1.s_price.className='trivial'
var displayUnitPrice
position = tempUnitPrice.toString().indexOf(".");
tempHold = tempUnitPrice.toString().substr(position + 1);
if (tempHold.length == 1) {
displayUnitPrice = tempUnitPrice + "0";
} else {
displayUnitPrice = tempUnitPrice;
}
document.form1.s_price.value=displayUnitPrice;
document.getElementById("sproceed").innerHTML = formatCurrency(sell_gamt);
document.getElementById("scomm").innerHTML = formatCurrency(s_comm);
document.getElementById("scfee").innerHTML = formatCurrency(s_cfee);
document.getElementById("sstmp").innerHTML = formatCurrency(s_stmp_duty);
document.getElementById("snett").innerHTML = formatCurrency(s_nett_amt);
document.getElementById("snettamt").innerHTML = formatCurrency(s_nett_amt);
var rArray = new Array(2);
rArray[0] = s_nett_amt;
rArray[1] = tempUnitPrice;
return rArray;
}
function dec2Round (num1) {
num2 = Math.round(num1*100)/100;
return num2;
}
function dec3Round (num1) {
num2 = Math.round(num1*1000)/1000;
return num2;
}
function buyProceedCalc(qty, bprice, clr_type, bcomm, comm_type) {
buy_gamt = grossAmount(qty, bprice);
if (comm_type=='0'){
b_stmp_duty=0; b_cfee=0; b_comm=0;}
else {
if (comm_type=='1') {
b_stmp_duty = 0;
} else {
b_stmp_duty = stampDuty(buy_gamt,comm_type);
}
b_cfee = clrfeeCalc(buy_gamt, clr_type);
b_comm = commCalc(buy_gamt, bcomm, comm_type);
}
b_nett_amt = buy_gamt + b_stmp_duty + b_cfee + b_comm;
document.getElementById("bproceed").innerHTML = formatCurrency(buy_gamt);
document.getElementById("bcomm").innerHTML = formatCurrency(b_comm);
document.getElementById("bcfee").innerHTML = formatCurrency(b_cfee);
document.getElementById("bstmp").innerHTML = formatCurrency(b_stmp_duty);
document.getElementById("bnett").innerHTML = formatCurrency(b_nett_amt);
document.getElementById("bnettamt").innerHTML = formatCurrency(b_nett_amt);
return b_nett_amt;
}
function sellProceedCalc(qty, sprice, clr_type, scomm, comm_type){
sell_gamt = grossAmount(qty, sprice);
if (comm_type=='1') {
s_stmp_duty = 0;
} else {
s_stmp_duty = stampDuty(sell_gamt,comm_type);
}
s_cfee = clrfeeCalc(sell_gamt, clr_type);
s_comm = commCalc(sell_gamt, scomm, comm_type);
s_nett_amt = sell_gamt - s_stmp_duty - s_cfee - s_comm;
document.getElementById("sproceed").innerHTML = formatCurrency(sell_gamt);
document.getElementById("scomm").innerHTML = formatCurrency(s_comm);
document.getElementById("scfee").innerHTML = formatCurrency(s_cfee);
document.getElementById("sstmp").innerHTML = formatCurrency(s_stmp_duty);
document.getElementById("snett").innerHTML = formatCurrency(s_nett_amt);
document.getElementById("snettamt").innerHTML = formatCurrency(s_nett_amt);
return s_nett_amt;
}
function grossAmount(qty,price) {
g_amt = parseFloat(qty) * Math.round(parseFloat(price) * 10000);
return g_amt/10000;
}
function stampDuty(g_amt,comm_type) {
/*if(g_amt <= Math.round(g_amt)){
stmp_duty = Math.round(g_amt/1000);
if (stmp_duty < 1){
stmp_duty = 1.00;
} else {
stmp_duty =stmp_duty;
}
} else {*/
if (comm_type=='1') {
stmp_duty = 0;
} else {
stmp_duty = Math.ceil((g_amt/1000));
/*}*/
if (stmp_duty > 200) {
stmp_duty = 200;
}
}
return stmp_duty;
}
function clrfeeCalc(g_amt,cl_type) {
if(cl_type == 'om'){
c_fee = g_amt * 0.0003;
if(c_fee > 200){
c_fee = 200;
} else {
c_fee = c_fee;
}
return (Math.ceil(c_fee * 100)) /100 ;
} else {
max_cfee = 200;
min_cfee = 10;
tmp = g_amt * 0.0003;
if(tmp <= 10) {
return min_cfee;
} else {
if(tmp >= 200)
return max_cfee;
else
return (Math.round(tmp * 100))/100;
}
}
}
function commCalc(g_amt,comm,comm_type) {
if (comm_type =='1'){
commission = g_amt * comm * comm_type/100;
if (commission < 2.00) {
commission = 2.00;
}
} else {
commission = g_amt * comm * 1/100;
if (commission < 12.00) {
commission = 12.00;
}
}
return (Math.round(commission * 100))/100;
}
function incrementStep(price,step){
sum = price + step;
return sum;
}
function determineBit (price) {
var value = "0";
if (parseFloat(price) < 1)
value = "0.005";
else if ((parseFloat(price) >= 1) && (parseFloat(price) < 3))
value = "0.01";
else if ((parseFloat(price) >= 3) && (parseFloat(price) < 5))
value = "0.02";
else if ((parseFloat(price) >= 5) && (parseFloat(price) < 10))
value = "0.05";
else if ((parseFloat(price) >= 10) && (parseFloat(price) < 25))
value = "0.10";
else if ((parseFloat(price) >= 25) && (parseFloat(price) < 100))
value = "0.25";
else
value = "0.50";
return value;
}
function determineBitDecrement (price) {
var value = "0";
if (parseFloat(price) <= 1)
value = "0.005";
else if ((parseFloat(price) > 1) && (parseFloat(price) <= 3))
value = "0.01";
else if ((parseFloat(price) > 3) && (parseFloat(price) <= 5))
value = "0.02";
else if ((parseFloat(price) > 5) && (parseFloat(price) <= 10))
value = "0.05";
else if ((parseFloat(price) > 10) && (parseFloat(price) <= 25))
value = "0.10";
else if ((parseFloat(price) > 25) && (parseFloat(price) <= 100))
value = "0.25";
else
value = "0.50";
return value;
}
function formatCurrency(num) {
num = num.toString().replace(/$|\,/g,'');
if(isNaN(num))
num = "0";
//cents = Math.ceil((Math.abs(num)*100)%100);
cents = Math.ceil(dec2Round((Math.abs(num)*100)%100));
if (num > 0){
num = Math.floor((num*100)/100).toString();
} else {
num = Math.ceil((num*100)/100).toString();
}
if(cents < 10) cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
if(num>=0)
num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
else
if(num.length <=4)
num = num.substring(0,num.length-(4*i+3))+num.substring(num.length-(4*i+3));
else
num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
return (num + '.' + cents);
}
function formatResult(num) {
if(isNaN(num))
num = "0";
//cents = Math.ceil((Math.abs(num)*100)%100);
cents = Math.ceil(dec2Round((Math.abs(num)*100)%100));
if (num > 0){
num = Math.floor((num*100)/100).toString();
} else {
num = Math.ceil((num*100)/100).toString();
}
if(cents < 10)
cents = "0" + cents;
return (num + '.' + cents);
}
function formatCurrencyThreeDecimal(num) {
num = num.toString().replace(/$|\,/g,'');
if(isNaN(num)) num = "0";
if (num < Math.round(num)) {
newnum = num - 0.5;
absnewnum = Math.round(newnum);
}
else
absnewnum = Math.round(num);
var str = Math.abs(num-absnewnum) + 0.0005;
var srt = str.toString();
ss = srt.substring(1,5);
con = absnewnum + ss;
return con;
}
function formatBreakEven(num) {
num = num.toString().replace(/$|\,/g,'');
if(isNaN(num)) num = "0";
if (num < Math.round(num))
{
newnum = num - 0.5;
absnewnum = Math.round(newnum);
}
else
absnewnum = Math.round(num);
var str = Math.abs(num-absnewnum);
var srt = str.toString();
ss = srt.substring(1,5);
con = absnewnum + ss;
return con;
}
/* function breakEvenCalc(qty, bprice,comm_type,bcomm,scomm){
if(comm_type =='1')
breven = ((1.0014+bcomm/100)/(0.9986-scomm/100))*bprice + 0.002;
else{
breven = (1.0014/(0.9986-scomm/100))*bprice + 0.002;
}
document.getElementById("breakeven").innerHTML = formatBreakEven(breven);
return;
}*/
function breakEvenCalc(qty, bprice,comm_type,bcomm,scomm, clr_type){
buy_gamt = grossAmount(qty, bprice);
b_stmp_duty = stampDuty(buy_gamt,comm_type);
b_cfee = clrfeeCalc(buy_gamt, clr_type);
b_comm = commCalc(buy_gamt, bcomm, comm_type);
b_nett_amt = buy_gamt+(2*b_stmp_duty)+(2*b_cfee)+(2*b_comm);
if(comm_type =='1' || comm_type =='2' )
breven = ((b_nett_amt/qty)+0.0016) ;
else{
breven = (((buy_gamt+b_stmp_duty+b_cfee+b_comm)/qty)+0.0015);
}
document.getElementById("breakeven").innerHTML = formatBreakEven(breven);
return;
}
function sellCalc(qty, sprice, clr_type, scomm, comm_type){
sell_gamt = grossAmount(qty, sprice);
s_stmp_duty = stampDuty(sell_gamt,comm_type);
s_cfee = clrfeeCalc(sell_gamt, clr_type);
s_comm = commCalc(sell_gamt, scomm, comm_type);
s_nett_amt = sell_gamt - s_stmp_duty - s_cfee - s_comm;
return s_nett_amt;
}
function autoStepComputation(qty, price, comm, cfee, stepsign, ks, cost, comm_type) {
var priceArr = new Array();
var netAmtArr = new Array();
var plArr = new Array();
priceArr[0] = price;
netAmtArr[0] = sellCalc(qty, price, cfee, comm, comm_type);
plArr[0] = netAmtArr[0] - cost;
//if(stepsign == 'd')
// step = step * (-1);
pr = parseFloat(price);
//st = parseFloat(step);
switch(ks) {
/*
case 'b_only':
for(var i = 1; i <= 10; i++) {
pr = incrementStep(pr, st);
priceArr[i] = formatCurrencyThreeDecimal(pr);
netAmtArr[i] = sellCalc(qty, pr, cfee, comm, comm_type);
plArr[i] = netAmtArr[i] - cost;
}
document.getElementById("txt0").innerHTML = formatCurrencyThreeDecimal(priceArr[0]);
document.getElementById("sp0").innerHTML = formatCurrency(netAmtArr[0]);
document.getElementById("pl0").innerHTML = formatCurrency(plArr[0]);
document.getElementById("txt1").innerHTML = priceArr[1];
document.getElementById("sp1").innerHTML = formatCurrency(netAmtArr[1]);
document.getElementById("pl1").innerHTML = formatCurrency(plArr[1]);
document.getElementById("txt2").innerHTML = priceArr[2];
document.getElementById("sp2").innerHTML = formatCurrency(netAmtArr[2]);
document.getElementById("pl2").innerHTML = formatCurrency(plArr[2]);
document.getElementById("txt3").innerHTML = priceArr[3];
document.getElementById("sp3").innerHTML = formatCurrency(netAmtArr[3]);
document.getElementById("pl3").innerHTML = formatCurrency(plArr[3]);
document.getElementById("txt4").innerHTML = priceArr[4];
document.getElementById("sp4").innerHTML = formatCurrency(netAmtArr[4]);
document.getElementById("pl4").innerHTML = formatCurrency(plArr[4]);
document.getElementById("txt5").innerHTML = priceArr[5];
document.getElementById("sp5").innerHTML = formatCurrency(netAmtArr[5]);
document.getElementById("pl5").innerHTML = formatCurrency(plArr[5]);
document.getElementById("txt6").innerHTML = priceArr[6];
document.getElementById("sp6").innerHTML = formatCurrency(netAmtArr[6]);
document.getElementById("pl6").innerHTML = formatCurrency(plArr[6]);
document.getElementById("txt7").innerHTML = priceArr[7];
document.getElementById("sp7").innerHTML = formatCurrency(netAmtArr[7]);
document.getElementById("pl7").innerHTML = formatCurrency(plArr[7]);
document.getElementById("txt8").innerHTML = priceArr[8];
document.getElementById("sp8").innerHTML = formatCurrency(netAmtArr[8]);
document.getElementById("pl8").innerHTML = formatCurrency(plArr[8]);
document.getElementById("txt9").innerHTML = priceArr[9];
document.getElementById("sp9").innerHTML = formatCurrency(netAmtArr[9]);
document.getElementById("pl9").innerHTML = formatCurrency(plArr[9]);
document.getElementById("txt10").innerHTML = priceArr[10];
document.getElementById("sp10").innerHTML = formatCurrency(netAmtArr[10]);
document.getElementById("pl10").innerHTML = formatCurrency(plArr[10]);
break;
case 's_only':
plArr[0] = "- N.A. -";
for(var j = 1; j <= 10; j++){
pr = incrementStep(pr, st);
priceArr[j] = formatCurrencyThreeDecimal(pr);
netAmtArr[j] = formatCurrency(sellCalc(qty, pr, cfee, comm, comm_type));
plArr[j] = "- N.A. -";
}
document.getElementById("txt0").innerHTML = formatCurrencyThreeDecimal(priceArr[0]);
document.getElementById("sp0").innerHTML = formatCurrency(netAmtArr[0]);
document.getElementById("pl0").innerHTML = plArr[0];
document.getElementById("txt1").innerHTML = priceArr[1];
document.getElementById("sp1").innerHTML = netAmtArr[1];
document.getElementById("pl1").innerHTML = plArr[1];
document.getElementById("txt2").innerHTML = priceArr[2];
document.getElementById("sp2").innerHTML = netAmtArr[2];
document.getElementById("pl2").innerHTML = plArr[2];
document.getElementById("txt3").innerHTML = priceArr[3];
document.getElementById("sp3").innerHTML = netAmtArr[3];
document.getElementById("pl3").innerHTML = plArr[3];
document.getElementById("txt4").innerHTML = priceArr[4];
document.getElementById("sp4").innerHTML = netAmtArr[4];
document.getElementById("pl4").innerHTML = plArr[4];
document.getElementById("txt5").innerHTML = priceArr[5];
document.getElementById("sp5").innerHTML = netAmtArr[5];
document.getElementById("pl5").innerHTML = plArr[5];
document.getElementById("txt6").innerHTML = priceArr[6];
document.getElementById("sp6").innerHTML = netAmtArr[6];
document.getElementById("pl6").innerHTML = plArr[6];
document.getElementById("txt7").innerHTML = priceArr[7];
document.getElementById("sp7").innerHTML = netAmtArr[7];
document.getElementById("pl7").innerHTML = plArr[7];
document.getElementById("txt8").innerHTML = priceArr[8];
document.getElementById("sp8").innerHTML = netAmtArr[8];
document.getElementById("pl8").innerHTML = plArr[8];
document.getElementById("txt9").innerHTML = priceArr[9];
document.getElementById("sp9").innerHTML = netAmtArr[9];
document.getElementById("pl9").innerHTML = plArr[9];
document.getElementById("txt10").innerHTML = priceArr[10];
document.getElementById("sp10").innerHTML = netAmtArr[10];
document.getElementById("pl10").innerHTML = plArr[10];
break;
*/
case 'b_s':
for(var k=1; k<=10; k++){
pr = dec3Round(pr);
if (stepsign == 'i') {
minBit = determineBit(pr);
if (k ==1) {
//alert((parseFloat(pr) + parseFloat(minBit)) * 100);
pr = (parseFloat(pr) + parseFloat(minBit)) - ((dec3Round(((parseFloat(pr) + parseFloat(minBit)) * 100)) % (parseFloat(minBit) * 100))/100);
//pr = (parseFloat(pr) + parseFloat(minBit)) - ((((pr + minBit) * 100) % (minBit * 100))/100);
} else {
pr = (parseFloat(pr) + parseFloat(minBit));
}
} else {
minBitDecrement = determineBitDecrement(pr);
if (k == 1) {
minBit = determineBit(pr);
holder = (dec3Round(((parseFloat(pr) + parseFloat(minBit)) * 100)) % (parseFloat(minBit) * 100))/100;
pr = dec3Round(parseFloat(pr)) - ((dec3Round(((parseFloat(pr) + parseFloat(minBit)) * 100)) % (parseFloat(minBit) * 100))/100);
minBitDecrement = determineBitDecrement(pr);
if (holder == 0) {
pr = dec3Round((parseFloat(pr) - parseFloat(minBitDecrement)));
}
} else {
minBitDecrement = determineBitDecrement(pr);
pr = dec3Round((parseFloat(pr) - parseFloat(minBitDecrement)));
}
}
//pr = incrementStep(pr, st);
priceArr[k] = pr;
netAmtArr[k] = sellCalc(qty, pr, cfee, comm, comm_type);
//plArr[k] = (Math.ceil(parseFloat(netAmtArr[k])*100) /100) - (Math.ceil(parseFloat(cost)*100) /100);
plArr[k] = formatResult(netAmtArr[k]) - formatResult(cost);
}
document.getElementById("txt0").innerHTML = formatCurrencyThreeDecimal(priceArr[0]);
document.getElementById("sp0").innerHTML = formatCurrency(netAmtArr[0]);
document.getElementById("pl0").innerHTML = formatCurrency(plArr[0]);
document.getElementById("txt1").innerHTML = formatCurrencyThreeDecimal(priceArr[1]);
document.getElementById("sp1").innerHTML = formatCurrency(netAmtArr[1]);
document.getElementById("pl1").innerHTML = formatCurrency(plArr[1]);
document.getElementById("txt2").innerHTML = formatCurrencyThreeDecimal(priceArr[2]);
document.getElementById("sp2").innerHTML = formatCurrency(netAmtArr[2]);
document.getElementById("pl2").innerHTML = formatCurrency(plArr[2]);
document.getElementById("txt3").innerHTML = formatCurrencyThreeDecimal(priceArr[3]);
document.getElementById("sp3").innerHTML = formatCurrency(netAmtArr[3]);
document.getElementById("pl3").innerHTML = formatCurrency(plArr[3]);
document.getElementById("txt4").innerHTML = formatCurrencyThreeDecimal(priceArr[4]);
document.getElementById("sp4").innerHTML = formatCurrency(netAmtArr[4]);
document.getElementById("pl4").innerHTML = formatCurrency(plArr[4]);
document.getElementById("txt5").innerHTML = formatCurrencyThreeDecimal(priceArr[5]);
document.getElementById("sp5").innerHTML = formatCurrency(netAmtArr[5]);
document.getElementById("pl5").innerHTML = formatCurrency(plArr[5]);
document.getElementById("txt6").innerHTML = formatCurrencyThreeDecimal(priceArr[6]);
document.getElementById("sp6").innerHTML = formatCurrency(netAmtArr[6]);
document.getElementById("pl6").innerHTML = formatCurrency(plArr[6]);
document.getElementById("txt7").innerHTML = formatCurrencyThreeDecimal(priceArr[7]);
document.getElementById("sp7").innerHTML = formatCurrency(netAmtArr[7]);
document.getElementById("pl7").innerHTML = formatCurrency(plArr[7]);
document.getElementById("txt8").innerHTML = formatCurrencyThreeDecimal(priceArr[8]);
document.getElementById("sp8").innerHTML = formatCurrency(netAmtArr[8]);
document.getElementById("pl8").innerHTML = formatCurrency(plArr[8]);
document.getElementById("txt9").innerHTML = formatCurrencyThreeDecimal(priceArr[9]);
document.getElementById("sp9").innerHTML = formatCurrency(netAmtArr[9]);
document.getElementById("pl9").innerHTML = formatCurrency(plArr[9]);
break;
}
}
function resetForm(){
document.getElementById("bproceed").innerHTML = "0.00";
document.getElementById("bcomm").innerHTML = "0.00";
document.getElementById("bcfee").innerHTML = "0.00";
document.getElementById("bstmp").innerHTML = "0.00";
document.getElementById("bnett").innerHTML = "0.00";
document.getElementById("bnettamt").innerHTML = "0.00";
document.getElementById("sproceed").innerHTML = "0.00";
document.getElementById("scomm").innerHTML = "0.00";
document.getElementById("scfee").innerHTML = "0.00";
document.getElementById("sstmp").innerHTML = "0.00";
document.getElementById("snett").innerHTML = "0.00";
document.getElementById("snettamt").innerHTML = "0.00";
document.getElementById("breakeven").innerHTML = "0.00";
document.getElementById("profit_loss").innerHTML= "0.00";
document.getElementById("txt0").innerHTML = "0.00";
document.getElementById("sp0").innerHTML = "0.00";
document.getElementById("pl0").innerHTML = "0.00";
document.getElementById("txt1").innerHTML = "0.00";
document.getElementById("sp1").innerHTML = "0.00";
document.getElementById("pl1").innerHTML = "0.00";
document.getElementById("txt2").innerHTML = "0.00";
document.getElementById("sp2").innerHTML = "0.00";
document.getElementById("pl2").innerHTML = "0.00";
document.getElementById("txt3").innerHTML = "0.00";
document.getElementById("sp3").innerHTML = "0.00";
document.getElementById("pl3").innerHTML = "0.00";
document.getElementById("txt4").innerHTML = "0.00";
document.getElementById("sp4").innerHTML = "0.00";
document.getElementById("pl4").innerHTML = "0.00";
document.getElementById("txt5").innerHTML = "0.00";
document.getElementById("sp5").innerHTML = "0.00";
document.getElementById("pl5").innerHTML = "0.00";
document.getElementById("txt6").innerHTML = "0.00";
document.getElementById("sp6").innerHTML = "0.00";
document.getElementById("pl6").innerHTML = "0.00";
document.getElementById("txt7").innerHTML = "0.00";
document.getElementById("sp7").innerHTML = "0.00";
document.getElementById("pl7").innerHTML = "0.00";
document.getElementById("txt8").innerHTML = "0.00";
document.getElementById("sp8").innerHTML = "0.00";
document.getElementById("pl8").innerHTML = "0.00";
document.getElementById("txt9").innerHTML = "0.00";
document.getElementById("sp9").innerHTML = "0.00";
document.getElementById("pl9").innerHTML = "0.00";
document.form1.b_comm.value="0.42";
document.form1.s_comm.value="0.42";
document.form1.b_price.value="";
document.form1.s_price.value="";
document.form1.d_profit.value="";
document.form1.quantity.value="";
document.form1.s_price.disabled = false;
document.form1.d_profit.disabled = false;
}
function disableSell() {
if (document.form1.d_profit.value != "") {
document.form1.s_price.disabled = true;
document.form1.s_price.value="";
} else {
document.form1.s_price.disabled = false;
}
}
function disableDProfit() {
if (document.form1.s_price.value != "") {
document.form1.d_profit.disabled = true;
} else {
document.form1.d_profit.disabled = false;
}
}
//-->
</script>
<script language="JavaScript"><!--
function timer() {
setTimeout("parent.main.location.href='/IST/demand.jsp?callingPage=/IST/StockCalculator.jsp'",270000);
}
function refreshFrame() {
parent.dummyframe.location.href='/mbb/scripts/dummy.jsp?BV_SessionID=@@@@1694685007.1163560345@@@@&BV_EngineID=ccddaddjgiijffecflgcehfdfkgdgij.0';
}
refreshFrame();
//--></script>
<br />
<form name="form1">
<table border="0" cellpadding="0" cellspacing="2" style="width: 100%px;">
<tbody>
<tr>
<td height="18" valign="top">Enter the details and click on the <i>compute</i>
button to find out if you are making a <i>profit</i> or a <i>loss</i>.
</td>
</tr>
<tr bgcolor="#FA6900">
<td bgcolor="#FA6900" height="16"><span style="color: black;"><b> Contract Details</b></span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td><table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td height="20" width="8%"></td>
<td align="center" width="23%"><span style="color: black;">No of Shares</span></td>
<td align="center" width="23%"><span style="color: black;">Price (RM)</span></td>
<td align="center" width="23%"><span style="color: black;">Brokerage Rate</span></td>
<td align="center" width="23%"><span style="color: black;">Desired Profit</span></td>
</tr>
<tr>
<td align="center"><span style="color: black;">Buy</span></td>
<td align="center"><input maxlength="8" name="quantity" size="8" /></td>
<td align="center"><input maxlength="6" name="b_price" size="6" /></td>
<td align="center"><input maxlength="6" name="b_comm" size="6" value="0.42" /></td>
<td align="center"><input maxlength="10" name="d_profit" onblur="disableSell(); return false" size="10" /></td>
</tr>
<tr>
<td align="center"><span style="color: black;">Sell</span></td>
<td></td>
<td align="center"><input maxlength="6" name="s_price" onblur="disableDProfit(); return false" size="6" /></td>
<td align="center"><input maxlength="6" name="s_comm" size="6" value="0.42" /></td>
<td></td>
</tr>
<tr>
<td colspan="4" height="2"></td>
</tr>
</tbody></table>
</td>
</tr>
<tr bgcolor="#EBF2F9">
<td align="center" height="22" valign="bottom"><table border="0" cellpadding="1" cellspacing="0">
<tbody>
<tr>
<td><input onclick="summaryReport(document.form1.quantity.value,document.form1.comm_type.value,document.form1.b_price.value,document.form1.s_price.value,document.form1.clr_fee.value,document.form1.b_comm.value,document.form1.s_comm.value,document.form1.step_dir.value,document.form1.d_profit.value); return false" type="button" value="Compute" /></td>
<td width="10"></td>
<td><input onclick="resetForm(); return false" type="button" value=" Reset " /></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<hr size="1" width="100%" />
<table align="center" border="0" cellpadding="1" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td valign="top" width="5%"><table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td height="16"><span style="font-weight: bold;"><span style="font-style: italic;">Contract Type</span></span></td>
</tr>
<tr>
<td height="16">Share Bought From:</td>
</tr>
<tr>
<td><select name="comm_type" onchange="summaryReport(document.form1.quantity.value,document.form1.comm_type.value,document.form1.b_price.value,document.form1.s_price.value,document.form1.clr_fee.value,document.form1.b_comm.value,document.form1.s_comm.value,document.form1.step_dir.value,document.form1.d_profit.value); return false">
<option value="2">Existing KLSE contracts - Non Loan
</option><option value="1">Existing KLSE contracts - Loan
</option><option value="0">IPO / no brokerage contracts
</option></select>
</td>
</tr>
<tr>
<td>Clearing Fee For: </td>
</tr>
<tr>
<td><select name="clr_fee" onchange="summaryReport(document.form1.quantity.value,document.form1.comm_type.value,document.form1.b_price.value,document.form1.s_price.value,document.form1.clr_fee.value,document.form1.b_comm.value,document.form1.s_comm.value,document.form1.step_dir.value,document.form1.d_profit.value); return false">
<option value="om">On-Market
</option><option value="db">Direct Business
</option></select>
</td>
</tr>
</tbody></table>
</td>
<td width="95%"><table border="0" cellpadding="0" cellspacing="2" style="width: 100%px;">
<tbody>
<tr bgcolor="#FA6900">
<td bgcolor="#FA6900" height="16"><span style="color: black;"><b> Results</b></span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td><table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td height="14"><span style="color: black;"> Details</span></td>
<td align="right"><span style="color: black;">Buy </span></td>
<td align="right"><span style="color: black;">Sell </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Proceeds</span></td>
<td align="right"><span style="color: black;"><span id="bproceed">0.00</span> </span></td>
<td align="right"><span style="color: black;"><span id="sproceed">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Brokerage Fee</span></td>
<td align="right"><span style="color: black;"><span id="bcomm">0.00</span> </span></td>
<td align="right"><span style="color: black;"><span id="scomm">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Clearing Fee</span></td>
<td align="right"><span style="color: black;"><span id="bcfee">0.00</span> </span></td>
<td align="right"><span style="color: black;"><span id="scfee">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Stamp Duty</span></td>
<td align="right"><span style="color: black;"><span id="bstmp">0.00</span> </span></td>
<td align="right"><span style="color: black;"><span id="sstmp">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"> <b><span style="color: black;"><b>Net Amount</b></span></b></td>
<td align="right"><span style="color: black;"><b><span id="bnett">0.00</span> </b></span></td>
<td align="right"><span style="color: black;"><b><span id="snett">0.00</span> </b></span></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<table border="0" cellpadding="0" cellspacing="2" style="width: 100%px;">
<tbody>
<tr bgcolor="#FA6900">
<td bgcolor="#FA6900" height="16"><span style="color: black;"><b> Summary</b></span></td>
</tr>
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Breakeven Price</span></td>
<td align="right"><span style="color: black;"><span id="breakeven">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Buy Net Amount</span></td>
<td align="right"><span style="color: black;"><span id="bnettamt">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> Sell Net Amount</span></td>
<td align="right"><span style="color: black;"><span id="snettamt">0.00</span> </span></td>
</tr>
<tr bgcolor="#EBF2F9">
<td height="14"><span style="color: black;"> <b>Profit/Loss</b></span></td>
<td align="right"><span style="color: black;"><b><span id="profit_loss">0.00</span> </b></span></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<hr size="1" width="100%" />
<table align="center" border="0" cellpadding="1" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td valign="top" width="5%"><table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr>
<td colspan="2"><span style="font-weight: bold;"><span style="font-style: italic;">Price Range Index</span></span></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2" height="16">Stepping Method:</td>
</tr>
<tr>
<td colspan="2"><select name="step_dir" onchange="summaryReport(document.form1.quantity.value,document.form1.comm_type.value,document.form1.b_price.value,document.form1.s_price.value,document.form1.clr_fee.value,document.form1.b_comm.value,document.form1.s_comm.value,document.form1.step_dir.value,document.form1.d_profit.value); return false">
<option value="i">Increment
</option><option value="d">Decrement
</option></select>
</td>
</tr>
<script type="text/javascript"><!--
google_ad_client = "pub-5331508669102498";
google_ad_host = "pub-1556223355139109";
google_ad_host_channel="00000";
/* 120x90, created 9/2/09 */
google_ad_slot = "9375305979";
google_ad_width = 120;
google_ad_height = 90;
//-->
</script>
<script src="https://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script>
</tbody></table>
</td>
<td width="95%"><table border="0" cellpadding="0" cellspacing="2" style="width: 100%px;">
<tbody>
<tr bgcolor="#FA6900">
<td bgcolor="#FA6900" height="16"><span style="color: black;"><b> Auto Computation (Profit/Loss)</b></span></td>
</tr>
<tr>
<td><table border="0" cellpadding="0" cellspacing="0" style="width: 100%px;">
<tbody>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;">Sell Price </span></td>
<td><span style="color: black;">Net Amount </span></td>
<td><span style="color: black;">Profit/Loss </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt0">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp0">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl0">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt1">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp1">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl1">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt2">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp2">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl2">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt3">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp3">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl3">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt4">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp4">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl4">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt5">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp5">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl5">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt6">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp6">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl6">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt7">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp7">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl7">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt8">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp8">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl8">0.00</span> </span></td>
</tr>
<tr align="right" bgcolor="#EBF2F9">
<td align="center" height="14"><span style="color: black;"><span id="txt9">0.00</span> </span></td>
<td><span style="color: black;"><span id="sp9">0.00</span> </span></td>
<td><span style="color: black;"><span id="pl9">0.00</span> </span></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
</form>
How to use Bursa Profit Loss Calculator:<br />
<br />
1. Enter Number of Share<br />
<br />
2. Enter Buy Price<br />
<br />
3. Enter Sell Price<br />
<br />
4. Enter Brokerage Fee (default = 0.42%, you can change to you own brokerage fee)<br />
<br />
5. Press Compute<br />
<br />
6. You can also enter desired profit. For this, you do not need to enter sell price. When you click compute, the "Buy Price" box will show the price to sell to get your desired profit.<br />
<br />
Thank you for using Bursa Profit Loss Calculator<br />
<h3 class="post-title entry-title">
<a href="http://bursa-profit-loss-calculator.blogspot.com/2011/02/bursa-profit-loss-calculator.html">KLSE Profit Loss Calculator</a> </h3>
<div class="post-header">
</div>
How to use Profit Loss Calculator to calculate KLSE P/L trades :<br />
<br />
1. Enter Number of Share<br />
<br />
2. Enter Buy Price<br />
<br />
3. Enter Sell Price<br />
<br />
4. Enter Brokerage Fee (default = 0.42%, you can change to you own brokerage fee)<br />
<br />
5. Press Compute<br />
<br />
6. You can also enter desired profit. For this, you do not need to enter sell price. When you click compute, the "Buy Price" box will show the price to sell to get your desired profit.<br />
<br />
Thank you for using Bursa Profit Loss CalculatorPhilhttp://www.blogger.com/profile/17448379282758112615noreply@blogger.com