PureBytes Links
Trading Reference Links
|
Bharat
I'm coming in late on this one so may have got the wrong end of the stick.
Forgive me if that's the case.
Some time back I wanted to substitute the last value of one array with the
current value of another array. I thought about this for six months or more
and eventually came up with a solution. My custom array is a crude
Compensated Linear Regression Slope and the other array is similar to the
Williams "PS Fractal". I've forgotten how the code works exactly but I'm
sure I can jog my memory if necessary.
Here's an example of the PS Fractal and a 10 period compensated Linear
Regression Slope.
{PS Fractal}
ValueWhen(1,H<Ref(H,-2) AND Ref(H,-1)<Ref(H,-2) AND
Ref(H,-3)<Ref(H,-2) AND Ref(H,-4)<Ref(H,-2),Ref(H,-2));
{RL Comp LRS 10}
LinRegSlope(MP(),10)*(1000/If(C>1,C+Log(C),C));
and here's the version with the last value in the array substituted by
Max(MP(),Fml("PS Fractal"))
{RL Comp LRS-LA 10}
M:=Max(MP(),Fml("PS Fractal"));
D:=10;
A:=Sum(Ref(Cum(1)*MP(),-1),D-1)+Cum(1)*M;
B:=Sum(Cum(1),D);
F:=Sum(Ref(MP(),-1),D-1)+M;
G:=Sum(Pwr(Cum(1),2),D);
J:=(D*A-B*F)/(D*G-Pwr(B,2));
J*(1000/If(C>1,C+Log(C),C));
To substitute a different last value in a simple moving average array I
think this would be the way to go..
(Ref(Sum(data array,periods)-1)+"substitute last value")/periods.
An EMA could be a little more tricky so I won't attempt that at the moment.
Hope this is of some use.
Roy
----- Original Message -----
From: "Dusant" <cooldush@xxxxxxxxxxx>
To: <equismetastock@xxxxxxxxxxxxxxx>
Sent: Wednesday, August 20, 2003 1:08 AM
Subject: [EquisMetaStock Group] Re: Indicator to Plot Moving Average with
Fast Fourier Trans.
> If you want to hammmer your head against the wall, go ahead.
> Dusant
> --- In equismetastock@xxxxxxxxxxxxxxx, mudgalbharat <no_reply@xxxx>
> wrote:
> > Thanks a lot for all the responses.
> >
> > The reason why i am trying to integrate "Moving Average (MA)" and
> > Fast Fourier Transform (FFT)" is that when the data array in the
> > moving avergae is replaced by the current value of the FFT, we get a
> > very strong support/resistance level for the short term trading. I
> > would request the readers to replace the value "200" in the 200-
> > period simple moving average with the current value for any stock
> > and give any suggestions.
> >
> > regards
> >
> > Bharat Mudgal
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@xxxx>
> wrote:
> > > --- In equismetastock@xxxxxxxxxxxxxxx, mudgalbharat
> > <no_reply@xxxx>
> > > Bharat,
> > >
> > > Realistically the FFT may not be what you want. The reason for
> > asking
> > > you to plot the FFT on a chart was so that you could see this.
> > >
> > > If you still believe that the FFT can help your trading you could
> > use
> > > ranges to set the "if" statements. Something like 0 to 100 for a
> > > moving average of 10 and 101 to 200 for the next moving average
> > and
> > > so on. Hope this helps.
> > >
> > > Preston
> > >
> > >
> > >
> > > wrote:
> > > > Hello
> > > >
> > > > The value of FFT can be anythingit could be anything from 10 to
> > > 1700
> > > > or higher so writing so many IF statements would not do the
> > task !!
> > > >
> > > > regards
> > > >
> > > > Bharat Mudgal
> > > >
> > > > --- In equismetastock@xxxxxxxxxxxxxxx, pumrysh <no_reply@xxxx>
> > > wrote:
> > > > > Bharat,
> > > > >
> > > > > To learn about the formula language go to the files section
> > and
> > > > > download the Metastock Formula Language book in either pdf or
> > zip
> > > > > format. Once you've done that you will be better prepared to
> > make
> > > > the
> > > > > correct decision about how you want the formula to work. I
> > would
> > > > also
> > > > > suggest that you open a chart with a price plot in one window
> > and
> > > > the
> > > > > FFT in another.
> > > > >
> > > > > The basics of the formula will use one moving average if the
> > FFT
> > > > has
> > > > > a certain value and another moving average if the FFT has a
> > > > different
> > > > > value.
> > > > >
> > > > > Let's say the FFT has the following values of 10, 20, and 30.
> > > Your
> > > > > plan is to reflect those values in your moving average. You
> > would
> > > > > write the following:
> > > > >
> > > > > MYMA:= if(FFT=10,mov(close,10,e),if(FFT=20,mov(close,20,e),if
> > > > > (FFT=30,mov(close,30,e),mov(close,3,e))));
> > > > > MYMA
> > > > >
> > > > > Note that in the formula above if the FFT does not exactly
> > equal
> > > a
> > > > > value of 10,20,or 30 you would get a 3 day moving average or
> > > > > mov(close,3,e). You may wish to change these parameters to
> > ranges
> > > > of
> > > > > 5 to 15, 16 to 25, and 26 to 35 instead. This would be
> > > > accomplished
> > > > > by using
> > > > > if(FFT>5 and FFT<15,mov(close,10,e).
> > > > > This is something that you will need to decide based on the
> > > values
> > > > of
> > > > > the FFT that you see on your chart.
> > > > >
> > > > > You may also find it beneficial to visit a couple of formula
> > > sites
> > > > to
> > > > > determine how others have used the "if" statement. Hope this
> > > helps.
> > > > >
> > > > > Preston
> > > > >
> > > > >
>
>
>
> To unsubscribe from this group, send an email to:
> equismetastock-unsubscribe@xxxxxxxxxxxxxxx
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/BefplB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|