Portfolio Level Risk - How to mitigate


Portfolio Amount : 1,000,000

Allowable Risk on Portfolio : 10% or 100,000

Now individual stock threshold for Long and Short is say 10,000

With individual stock stop loss at 10% or 1,000

Now if I want to control my overall RISK ON PORTFOLIO at 10% then I should not invest anything new be it Long or Short till my portfolio risk reduces .

I am assuming there is a way to do this using AFL code or configuration setup while back testing.

If I could see what would be my Unrealized Risk for the stocks on float or unsettled at EVERY BAR level and divide that with total portfolio amount , I could have measured by RISK on portfolio.

Is there a way to do that ? Please give a direction if this could be possible using Back Testing set up OR AFL Coding. A sample for the same would be highly appreciated.

@sujoybardhan you can get some ideas on risk based position sizing here,


If you want to adjust your portfolio "EVERY BAR" then you will need to re-balance (too frequently IMHO) and probably the best way is using the Custom Backtest interface. On this forum you can look up re-balancing examples. A preliminary start in that direction for you is also in the Official Knowledge Base,


1 Like