CWB Risk Calc

Developer
Size
3,516 Kb
Views
4,048

How do I make an cwb risk calc?

What is a cwb risk calc? How do you make a cwb risk calc? This script and codes were developed by Nathan Gregg on 25 December 2022, Sunday.

CWB Risk Calc Previews

CWB Risk Calc - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CWB Risk Calc</title> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200" rel="stylesheet">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.min.css"> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- RISK CALC --> <div class="data_row" id="risk_calc"> <div class="inner_data_column"> <div class="data_main_bit data_main_bit_row"> <div class="panel rc_panel" id="risk_inputs"> <div class="data_title risk_calc_title"><div class="row_title">Inputs</div></div> <form> <label for="total_bal">Total Account Balance</label><input class="yellow_inputs" type="text" id="total_bal"/> <label for="risk_perc">Risk Percentage</label><input class="yellow_inputs" type="text" id="risk_perc"/> <label for="stop_perc">Stoploss Percentage</label><input class="yellow_inputs" type="text" id="stop_perc"/> <label for="fee">Fee Percentage</label><input class="yellow_inputs" type="text" id="fee"/> </form> </div> <div class="panel rc_panel" id="risk_summary"> <div class="data_title risk_calc_title"><div class="row_title">Results</div></div> <div> <div class="calc_result">Buy <span id="buy_amt">0</span><span>BTC</span> worth</div> <hr> <div class="calc_result">To include fee in trade,<br>buy <span id="buy_amt_with_fee">0</span><span>BTC</span> worth</div> <hr> <div><span id="risk_amt">0</span> BTC risked per trade </div> <div><span id="kill_amt">∞</span> losses at this value will kill your account</div> </div> </div> <div class="panel rc_panel"> <div class="data_title risk_calc_title"><div class="row_title" >Risk / Reward</div></div> <div class="table_container"> <table id="rr_table" data-toggle="table" data-classes="table table-no-bordered"> <thead> <th>Ratio</th> <th>Profit</th> <th>Profit Less Fee</th> </thead> <tbody> <tr> <td>1:1</td> <td></td> <td></td> </tr> <tr> <td>2:1</td> <td></td> <td></td> </tr> <tr> <td>3:1</td> <td></td> <td></td> </tr> <tr> <td>4:1</td> <td></td> <td></td> </tr> <tr> <td>5:1</td> <td></td> <td></td> </tr> <tr> <td>6:1</td> <td></td> <td></td> </tr> <tr> <td>7:1</td> <td></td> <td></td> </tr> <tr> <td>8:1</td> <td></td> <td></td> </tr> <tr> <td>9:1</td> <td></td> <td></td> </tr> </tbody> </table> </div> <!-- <table id="rr_table"> <thead> <tr> <th data-field="rr_ratio">R/R Ratio</th> <th data-field="reward">Reward</th> <th data-field="reward_fee">Reward incl. fee</th> </tr> </thead> <tbody> </tbody> </table> --> </div> </div> </div> </div> <!-- END --> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.0/jquery-ui.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

CWB Risk Calc - Script Codes CSS Codes

/* GENERAL */
* { margin: 0; padding: 0; font-size: 100%; font: inherit; vertical-align: baseline; outline: none; box-sizing: border-box; font-family: "Source Sans Pro",sans-serif; border-radius: none; color: #000;
}
.data_row { display: flex; flex-flow: row nowrap; width: 100%;
}
.inner_data_column { display: flex; flex-flow: column nowrap; width: 100%;
}
.data_title { display: flex; flex-flow: row nowrap; font-size: 1.4em; font-weight: 600; border-bottom: 2px solid grey;
}
.data_main_bit_row { display: flex; flex-flow: row nowrap; width: 100%;
}
.data_main_bit_column { display: flex; flex-flow: column nowrap; width: 100%;
}
/* TABLE */
.table_container { width: 100%; overflow: visible;
}
/* RISK CALC */
.rc_panel{ width: 30%; display: flex; flex-flow: column nowrap; align-items: center; align-content: center; justify-content: flex_start;
}
#risk_inputs form{ display: flex; flex-flow: column nowrap; justify-content: center; align-items: center; width: 100%;
}
#risk_inputs input { margin: 0 0 15px 0; width: 50%;
}
.calc_result { font-size: 1.2em;
}
#risk_summary span{ font-weight: 600; font-size: 1.2em; padding: 5px;
}

CWB Risk Calc - Script Codes JS Codes

/*-----------------*/
/* RISK CALC STUFF */
/*-----------------*/
/* VARIABLES*/
var total_bal, risk_perc, fee = 0, stop_perc, buy_amt, risk_amt, kill_amt, risk_amt_minus_fee;
// Risk Calc Calc
$("#total_bal, #risk_perc, #fee, #stop_perc").keyup(function(){ total_bal = Number($('#total_bal').val()); risk_perc = Number($('#risk_perc').val()); stop_perc = Number($('#stop_perc').val()); fee = Number($('#fee').val()); risk_amt = total_bal*(risk_perc/100); kill_amt = 100/risk_perc; buy_amt = Number((risk_amt/(stop_perc/100)).toFixed(5)); buy_amt_with_fee = Number((risk_amt/((stop_perc+fee)/100)).toFixed(5)); $('#risk_amt').html(risk_amt); $('#kill_amt').html(kill_amt); $('#buy_amt').html(buy_amt); $('#buy_amt_with_fee').html(buy_amt_with_fee); risk_amt_minus_fee = Number(risk_amt-(buy_amt*(fee/100))); for (i = 0; i < 10; i++) { var $tr = $('#rr_table tr:nth-child('+i+')'), $td1 = $tr.find('td:nth-child(2)'), $td2 = $tr.find('td:nth-child(3)'); $td1.html(risk_amt*i); $td2.html(risk_amt_minus_fee*i); }
});
/*
$('table#rr_table tr').each(function(i){
alert("hello" + i);
});
var $tr = $("tr:nth-of-type(" + i + ")"), $td1 = $tr, $td2 = ;
alert("hello2");
$tr.css( "background-color", "red" );
for (i = 0; i < 11; i++) { var $tr = $('<tr><td>' + i + ':1</td><td>' + (risk_amt*i) + '</td><td>' + (buy_amt_minus_fee*i) + '</td></tr>'); $('tbody').append($tr);
}
var $rewards = $('<div class="table_head">Reward</div><div>' + risk_amt + '</div><div>' + (risk_amt*2) + '</div><div>' + (risk_amt*3) + '</div><div>' + (risk_amt*4) + '</div><div>' + (risk_amt*5) + '</div><div>' + (risk_amt*6) + '</div><div>' + (risk_amt*7) + '</div><div>' + (risk_amt*8) + '</div><div>' + (risk_amt*9) + '</div><div>' + (risk_amt*10) + '</div>'); $('#rr_2').html($rewards);
*/
CWB Risk Calc - Script Codes
CWB Risk Calc - Script Codes
Home Page Home
Developer Nathan Gregg
Username nathansonic
Uploaded December 25, 2022
Rating 3
Size 3,516 Kb
Views 4,048
Do you need developer help for CWB Risk Calc?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Nathan Gregg (nathansonic) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!