PureBytes Links
Trading Reference Links
|
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 amibroker@xxxxxxxxxxxxxxx, "gmorlosky" <gmorlosky@xxx> wrote:
>
> Perfect
>
> --- In amibroker@xxxxxxxxxxxxxxx, "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
> >
>
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|