position-size
Calculate position-size given risk tolerance and distance to stop-loss
Install
npm install position-size
Use
▸ positionSize(capital
: number, riskAsPercentOfCapital
: number, percentDistanceToStopLoss
: number): Either‹string, number›
Defined in src/position-size.ts:39
Calculate position-size given risk-tolerance and distance to stop-loss.
Parameters:
Name | Type |
---|---|
capital |
number |
riskAsPercentOfCapital |
number |
percentDistanceToStopLoss |
number |
Returns: Either‹string, number›
positionSize1000, 1, 26//=> Right(384.6153846153846 positionSize1000, 150, 26//=> Left('Risk cannot exceed 100 percent')