I wrote a program to calculate the underwater equity - relative draw down related to the last 52 week high
and it looks good.
Below is the code for this and a screenshot
Now I would like to expand the program and calculate the average of all drawdown values in the displayed time period and draw it as a horizontal line in the chart. For this I wanted to write all drawdown values in an array and calculate the average value from these values and display it in the chart. However, I don't get a straight horizontal line, but a curve. Is anyone able to help me in this issue?
thanks in advance
Holger