I have a school project for calculus 2 and its an indicator based off the the Autoregressive price extrapolator by gpwr except it prints the predicted values into bars. I would like to add a confidence cloud to the indicator, but I've been having problems implementing it. Another two issues are I want it to recalculate only if there is a new bar not every tick and It is supposed to print blue bars if they are up and red bars if they are down, but it only prints blue ones. The cloud needs to have a linear moving average between the first predicted bar and the last predicted (Nfuture) bar so that the confidence cloud isnt fluctuating because that iMA is what the cloud will use to derive its curve.
The 2 period iMA equation for the first predicted bar to the last predicted bar (I think?):
The equation (I think) for the upper confidence line would be:
The equation (I think) for the lower confidence line:
The equation to fill the difference between upper and lower confidence lines:
The Current indicator looks like this:
The indicator with added confidence cloud (NOTE: the red line indicates the iMA, but it should not be visible when placed on a chart):