Created
December 8, 2025 08:30
-
-
Save steveast/605064ef9356d1e3d47059ad0120eaf4 to your computer and use it in GitHub Desktop.
рассчитывает размер позиции так, чтобы риск составлял ровно 1% от депозита, даже если стоп широкий (например, 5%).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function calcPositionSize(deposit, riskPercent, stopPercent) { | |
| const riskSum = deposit * (riskPercent / 100); // сколько деньгами ты готов потерять | |
| const position = riskSum / (stopPercent / 100); // размер позиции | |
| return position; | |
| } | |
| // Пример: | |
| const deposit = 10000; // депозит | |
| const riskPercent = 1; // рискуешь 1% | |
| const stopPercent = 5; // стоп 5% | |
| const positionSize = calcPositionSize(deposit, riskPercent, stopPercent); | |
| console.log("Размер позиции:", positionSize); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment