OPEN-SOURCE SCRIPT
Aggiornato

Nasan Risk Score & Postion Size Estimator

258
** THE RISK SCORE AND POSITION SIZE WILL ONLY BE CALCUTAED ON DIALY TIMEFRAME NOT IN OTHER TIMEFRAMES.

The typically accepted generic rule for risk management is not to risk more than 1% - 2 % of the capital in any given trade. It has its own basis however it does not take into account the stocks historic & current performance and does not consider the traders performance metrics (like win rate, profit ratio).

The Nasan Risk Score & Position size calculator takes into account all the listed parameters into account and estimates a Risk %. The position size is calculated using the estimated risk % , current ATR and a dynamically adjusted ATR multiple (ATR multiple is adjusted based on true range's volatility and stocks relative performance).

It follows a series of calculations:


Unadjusted Nasan Risk Score = (Min Risk)^a + b* [(Max Risk)^a - (Min Risk)^a]

Min Risk = ( 5 year weighted avg Annual Stock Return - 5 year weighted avg Annual Bench Return) / 5 year weighted avg Annual Max ATR%

Max Risk = ( 5 year weighted avg Annual Stock Return - 5 year weighted avg Annual Bench Return) / 5 year weighted avg Annual Min ATR%

The min and max return is calculated based on stocks excess return in comparison to the Benchmark return and adjusted for volatility of the stock.

When a stock underperforms the benchmark, the default is, it does not calculate a position size , however if we opt it to calculate it will use 1% for Min Risk% and 2% for Max Risk% but all the other calculations and scaling remain the same.
Rationale:
  • Stocks outperforming their benchmark with lower volatility (ATR%) score higher.
  • A stock with high returns but excessive volatility gets penalized.
  • This ensures volatility-adjusted performance is emphasized rather than absolute returns.


Depending on the risk preference aggressive or conservative

Aggressive Risk Scaling: a = max (m, n) and b = min (m, n)

Conservative Scaling: a = min (m, n) and b = max (m, n)

where n = traders win % /100 and m = 1 - (1/ (1+ profit ratio))

A default of 50% is used for win factor and 1.5 for profit ratio.

  • Aggressive risk scaling increases exposure when the strategy's strongest factor is favorable.
  • Conservative risk scaling ensures more stable risk levels by focusing on the weaker factor.


The Unadjusted Nasan risk is score is further refined based on a tolerance factor which is based on the stocks maximum annual drawdown and the trader's maximum draw down tolerance.

Tolerance = [100 - (Stocks 5 Year weighted avg annual Max Drawdown - Trader's Maximum Acceptable drawdown)]/100

The correction factor (Tolerance) adjusts the risk score based on downside risk. Here's how it works conceptually:
The formula calculates how much the stock's actual drawdown exceeds your acceptable limit.

If stocks maximum Annual drawdown is smaller than Trader's maximum acceptable drawdown % , this results in a positive correction factor (indicating the drawdown is within your acceptable range and increases the unadjusted score.

If stocks maximum Annual drawdown exceeds Trader's maximum acceptable drawdown %, the correction factor will decrease (indicating that the downside risk is greater than what you are comfortable with, so it will adjust the risk exposure).

Once the Risk Score (numerically equal to Risk %) The position size is calculated based on the current market conditions.
Nasan Risk Score (Risk%) = Unadjusted Nasan Risk Score * Tolerance.
Position Size = (Capital * Risk% )/ ATR-Multiplier * ATR

The ATR Multiplier is dynamically adjusted based on the stocks recent relative performance and the variability of the true range itself. It would range between 1 - 3.5.
The multiplier widens when conditions are not favorable decreasing the position size and increases position size when conditions are favorable.

This Calculation /Estimate Does not give you a very different result than the arbitrary 1% - 2%. However it does fine tune the % based on sock performance, traders performance and tolerance level.
Note di rilascio
updated benchmark calculation in NUHI

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.