[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Need help with formula, please...



PureBytes Links

Trading Reference Links

Ray,

There's a bit of info on Hurst CMAs here:

http://www.capitalstool.com/centered-moving-averages.htm

To displace an MA back in time you have to use a forward reference:

dma1 = Ref(MA(Close,28),14);

However, this won't have valid data for the last 14 bars, since those
bars are for days that haven't been yet, so to avoid confusion you
should blank them out:

dma1 = IIf(Cum(1)<=BarCount-14, Ref(MA(Close,28),14), Null);

Then you have to extrapolate the MA somehow to guess what it will look
like in those last 14 bars, which will give you data to do your Cross
with.

GP


--- In amibroker@xxxxxxxxxxxxxxx, "ax_ray2222" <ax_ray2222@xxx> wrote:
>
> GP, DMA(28,-14) is a negative displaced moving average ( a MA(28) 
> displaced 14 days back on the chart), so what I am looking is to get 
> a crossover signal from this DMA with a regular MA(9).
> I tried the cross function but it seems it does not work properly 
> when I look on the signals displaied on the charts.
> 
> Ray
> 
> 
> -- In amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@> 
> wrote:
> >
> > Sorry, I don't understand what you're asking. I haven't used
> > stockfetcher. What does DMA(28,-14) mean?
> > 
> > You can just use the Cross function to check for crossovers.
> > 
> > GP
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "ax_ray2222" <ax_ray2222@> wrote:
> > >
> > > GP, thank you for the help, I want to make a continuation of the 
> > > Displaced MA(28,-14) and with your help it will do this for the 
> last 14 
> > > days but it seems that it is verticaly displaced. Is any way we 
> can 
> > > make this to plot in the continuation of the DMA(28,-14). I'll 
> put here 
> > > the entire code I have at the moment, and if you used 
> stockfetcher.com 
> > > you can see the DMA(28,-14) there:
> > > 
> > > _SECTION_BEGIN("DispMA");
> > > P = ParamField("Field");
> > > Type = ParamList("Type", "Simple,Exponential,Double 
> Exponential,Tripple 
> > > Exponential,Wilders,Weighted");
> > > Periods = Param("Periods", 30, 2, 100 );
> > > Displacement = Param("Displacement", 15, -50, 50 );
> > > m = 0;
> > > 
> > > if( Type == "Simple" ) 					m = MA
> ( P, 
> > > Periods );
> > > if( Type == "Exponential" ) 			m = EMA( P, 
> Periods );
> > > if( Type == "Double Exponential" ) 	m = DEMA( P, Periods );
> > > if( Type == "Tripple Exponential" ) 	m = TEMA( P, 
> Periods );
> > > if( Type == "Wilders" ) 				m = Wilders( 
> P, 
> > > Periods );
> > > if( Type == "Weighted" ) 				m = WMA( P, 
> > > Periods );
> > > 
> > > Plot( m, _DEFAULT_NAME(), ParamColor("Color", ColorCycle), 
> ParamStyle
> > > ("Style"), 0, 0, Displacement );
> > > bi = BarIndex();
> > > s5 = IIf(bi-bi[0] >= BarCount-14, MA(Close, 14), Null);
> > > Plot( s5,_DEFAULT_NAME(), ParamColor("Color", ColorCycle), 
> ParamStyle
> > > ("Style") );
> > > _SECTION_END();
> > > 
> > > I'd like to be able to scan for the crossovers of the DMA with an 
> EMA
> > > (9) for example, and thst will happend only during the last 14 
> days, so 
> > > it will be actually a crossover of the s5 with the EMA(9) I guess.
> > > Do you any idea on this? 
> > > 
> > > thanks a lot, Ray
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@> 
> wrote:
> > > >
> > > > > Actually, I just noticed there's a new function called 
> BarIndex()
> > > > 
> > > > Sorry, just realised this is not a new function (got confused 
> by the
> > > > red star in the help) and that according to the help, it may 
> not be
> > > > accurate if QuickAFL is on. So if using that, I think you might 
> need:
> > > > 
> > > > bi = BarIndex();
> > > > s5 = IIf(bi-bi[0] >= BarCount-14, MA(Close, 5), Null);
> > > > 
> > > > GP
> > > >
> > >
> >
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
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/