init
This commit is contained in:
2
.npmignore
Normal file
2
.npmignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
.git
|
||||||
1
.npmrc
Normal file
1
.npmrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
//npm.pkg.github.com/:_authToken=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
|
||||||
36
README.md
Normal file
36
README.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Trading Calculators
|
||||||
|
|
||||||
|
Free trading calculators for forex, gold, and crypto traders.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
```bash
|
||||||
|
npm install @liudecai-one/trading-calculators-free
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
```js
|
||||||
|
const { positionSize, pipValue, fibonacci } = require('@liudecai-one/trading-calculators-free');
|
||||||
|
|
||||||
|
// Position size: account=$10K, risk=1%, stop=20 pips
|
||||||
|
const size = positionSize(10000, 1, 20);
|
||||||
|
console.log({ size }); // 0.5 lots
|
||||||
|
|
||||||
|
// Fibonacci retracement levels
|
||||||
|
const fib = fibonacci(1.1200, 1.1000);
|
||||||
|
console.log({ fib });
|
||||||
|
```
|
||||||
|
|
||||||
|
## Free Web Tools
|
||||||
|
- [Position Size Calculator](https://blog.quant-view.xyz/tools/position-size-calculator.html)
|
||||||
|
- [Pip Value Calculator](https://blog.quant-view.xyz/tools/pip-calculator.html)
|
||||||
|
- [Margin Calculator](https://blog.quant-view.xyz/tools/margin-calculator.html)
|
||||||
|
- [Fibonacci Calculator](https://blog.quant-view.xyz/tools/fibonacci-calculator.html)
|
||||||
|
- [ATR Calculator](https://blog.quant-view.xyz/tools/atr-calculator.html)
|
||||||
|
- [Risk-Reward Calculator](https://blog.quant-view.xyz/tools/risk-reward-calculator.html)
|
||||||
|
- [Drawdown Calculator](https://blog.quant-view.xyz/tools/drawdown-calculator.html)
|
||||||
|
|
||||||
|
## More Resources
|
||||||
|
- [Trading Blog](https://blog.quant-view.xyz)
|
||||||
|
- [GFIL Terminal](http://gfil-intel.xyz/)
|
||||||
|
- [Telegram Community](https://t.me/GFIL_Trading)
|
||||||
|
- [Discord Server](https://discord.gg/GMmMCD4MCr)
|
||||||
29
index.js
Normal file
29
index.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* Free Trading Calculators
|
||||||
|
* Web versions: https://blog.quant-view.xyz/tools/
|
||||||
|
* Telegram: https://t.me/GFIL_Trading
|
||||||
|
* Discord: https://discord.gg/GMmMCD4MCr
|
||||||
|
*/
|
||||||
|
|
||||||
|
function positionSize(accountBalance, riskPercent, stopLossPips, pipValue = 10) {
|
||||||
|
const riskAmount = accountBalance * (riskPercent / 100);
|
||||||
|
return parseFloat((riskAmount / (stopLossPips * pipValue)).toFixed(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
function pipValue(currencyPair, lotSize = 1) {
|
||||||
|
const rates = { "EURUSD": 10, "GBPUSD": 10, "USDJPY": 9.3, "XAUUSD": 10 };
|
||||||
|
return rates[currencyPair] * lotSize || 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fibonacci(high, low) {
|
||||||
|
const diff = high - low;
|
||||||
|
return {
|
||||||
|
"0.236": high - diff * 0.236,
|
||||||
|
"0.382": high - diff * 0.382,
|
||||||
|
"0.500": high - diff * 0.500,
|
||||||
|
"0.618": high - diff * 0.618,
|
||||||
|
"0.786": high - diff * 0.786,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { positionSize, pipValue, fibonacci };
|
||||||
22
package.json
Normal file
22
package.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "@liudecai-one/trading-calculators-free",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Free trading calculators: position size, pip value, margin, Fibonacci, ATR. Web versions at blog.quant-view.xyz/tools/",
|
||||||
|
"main": "index.js",
|
||||||
|
"keywords": [
|
||||||
|
"trading",
|
||||||
|
"forex",
|
||||||
|
"calculator",
|
||||||
|
"position-size",
|
||||||
|
"pip-calculator",
|
||||||
|
"margin-calculator",
|
||||||
|
"fibonacci",
|
||||||
|
"atr"
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://gitlab.com/liudecai110/gfil-trading-calculators.git"
|
||||||
|
},
|
||||||
|
"homepage": "https://blog.quant-view.xyz/tools/"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user