Hodrick-Prescott calculated on close

 

Hi,

I have a custom indicator called the Hodrick-Prescott filter, but it's not a "normal" one: normally this filter recalculates the past, but this one, if you do a visual-mode backtest with an empty EA, and you put it on the chart, it shows you what it would look like in a "dynamic environment" (live market). If you simply put it on the chart, it shows a smooth line, but if you place it on a visual-mode backtest, it shows a ragged, more bumpy line. Now my question is: how do I change this code that the indicator shows the ragged line instead of the smooth line when I put it on a chart for the first time. I tried exporting its values with a script into a csv, but it exports the smooth values, not the "real-time" behavior

.

Files:
hp_coc.mq4  3 kb
Reason: