Hello Ruben
I have enclosed the Mathematica notebook that explains the entire CDS calculation logic and shows the whole part related to the CCDS calculation.
Please note that the dynamic flow on the severity leg is 'random', so it will change every time you hit Enter. This was to simulate dynamic nature of future flows. If you want stable input, enter SeedRandom function with the specific seed number before the function call.
Hope this will help in your query. If you have any additional question, I will be glad to assist.
Kind regards
Igor
Attachments: