Here is the formula which takes it's key off of the last close as opposed to 
the cascading future dates.

//Shifting arrays
futClose = Ref(Close, 1);

OneF = Param("1F",1.05,0.80,1.2,0.05);
TwoF = Param("2F",1.00,0.80,1.2,0.05);
ThreeF = Param("3F",.95,0.80,1.2,0.05);
FourF = Param("4F",.90,0.80,1.2,0.05);
FiveF = Param("5F",.85,0.80,1.2,0.05);

//calculate new bars
futClose[BarCount-5] = futClose[BarCount-6] * OneF; // 1 period in the future
futClose[BarCount-4] = futClose[BarCount-6] * TwoF; // 2 periods in the future
futClose[BarCount-3] = futClose[BarCount-6] * ThreeF; // 3 periods in the future
futClose[BarCount-2] = futClose[BarCount-6] * FourF; // 4 periods in the future
futClose[BarCount-1] = futClose[BarCount-6] * FiveF; // 5 periods in the future

//plot is shifted !!! use xshift param if you need to plot it correctly
Plot (futClose, "", colorBlack, styleLine);

//calc indicator on calulated values is is shifeted as well!!!
MyMA = MA(futClose, 10);
Plot(MyMa, "", colorBlue, styleLine);

Title = FullName()+"\n" +Date()+" - " +"Close: "+C;


--- In [email protected], "gmorlosky" <gmorlo...@...> wrote:
>
> Perfect
> 
> --- In [email protected], "jtoth100" <jtoth100@> wrote:
> >
> > Hi,
> > 
> > There is no way to add to OHLC. But there is solution to this.
> > 
> > check this:
> > 
> > //Shifting arrays
> > futOpen = Ref(Open, 2);
> > futClose = Ref(Close, 2);
> > futHigh = Ref(High, 2);
> > futLow = Ref(Low, 2);
> > 
> > //calculate new bars
> > futOpen[BarCount-2] = futOpen[BarCount-3];
> > futClose[BarCount-2] = futClose[BarCount-3];
> > futHigh[BarCount-2] = futHigh[BarCount-3]*1.02;
> > futLow[BarCount-2] = futLow[BarCount-3]*0.99;
> > 
> > futOpen[BarCount-1] = futOpen[BarCount-2];
> > futClose[BarCount-1] = futClose[BarCount-2];
> > futHigh[BarCount-1] = futHigh[BarCount-2]*1.01;
> > futLow[BarCount-1] = futLow[BarCount-2]*0.99;
> > 
> > 
> > //plot is shifted !!! use xshift param if you need to plot it correctly
> > PlotOHLC(futOpen, futHigh, futLow, futClose, "", colorBlack);
> > 
> > //calc indicator on calulated values is is shifeted as well!!!
> > MyMA = MA(futClose, 10);
> > Plot(MyMa, "", colorBlue, styleLine);
> > 
> > Y
> >
>


Reply via email to