Hello 

I tried to post yesterday however my message seems got lost (I can't see it 
appears in the group after long hours), so I post again today, I'm sorry if 
this is a duplicate message: 

my reply yesterday: about doing Lowess smoothing in R-plugin 

Example:  (please adjust the span parameter accordingly) 

RMathSetArray(BarIndex(),"x"); 
RMathSetArray(Close,"y");
RMathProcedure("y.loess <- loess(y ~ x, span=0.25, data..frame(x=x,y=y))");
RMathProcedure("y.predict <- predict(y.loess, data.frame(x=x))"); 
Lowress = RMathGetArray("y.predict"); 
Plot(Lowress,"Lowress", colorRed); 

Polyfit: thanks Ed for the link of AFL, below is similar function in R (I 
hardcoded the nth order, pls adjust the polynomia order accordingly) 

Example: 

RMathSetArray(BarIndex(),"x"); 
RMathSetArray(Close,"y");
RMathProcedure("y.polyfit <- lm( y ~ x + I(x^2) + I(x^3) + I(x^4)+I(x^5) + 
I(x^6) + I(x^7) + I(x^8))");
// RMathProcedure("y.polyfit <- lm( y ~ x + I(x^2) + I(x^3) + I(x^4))");  //  
4th order 
RMathProcedure("y.predict <- predict(y.polyfit, data.frame(x=x))"); 
Polyfit = RMathGetArray("y.predict"); 
Plot(Polyfit,"Polyfit", colorRed); 

regards,
SW




________________________________
From: Edward Pottasch <[email protected]>
To: [email protected]
Sent: Tuesday, April 14, 2009 6:12:01 PM
Subject: Re: [amibroker] Re: Gravity center mustafa Belkhayate





i think you are right.  Fred posted some great code in the library, see: 
http://www.amibroke r.com/library/ formula.php? id=731
 
rgds, Ed

 
 
 
----- Original Message ----- 
From: Ed Hoopes 
To: amibro...@yahoogrou ps.com 
Sent: Friday, April 10, 2009 5:04 PM
Subject: [amibroker] Re: Gravity center mustafa Belkhayate

I checked the UTube video. The upper and lower bands + the dashed lines are a 
least squares regression fit to a cubic equation. They are offset above and 
below by some measure of volatility like ATR. The yellow line in the middle is 
a least squares fit to a straight line (linear regression) over the same number 
of bars as the cubic.

I have coded a least squares fit to a quadratic in AFL - and there have been 
postings here also. The main problem with coding is that the x-axis time values 
numbers get so big that they occasionally exceed the maximum 32 bit floating 
point range (10^38 i think) causing the calculation to blow up. I got around 
this problem by copying the price/time data to separate arrays with time time 
array starting at zero. This stopped the code from blowing up when the numbers 
got too big.

With a cubic, things would be even worse since the matrix is 4x4 rather than 
3x3 as in the quadratic case..

ReefBreak

--- In amibro...@yahoogrou ps.com, "conrad_faber" <cfa...@...> wrote:
>
> The money he claims to make comes mostly from his Martingale MM....many small 
> wins till the Tsunami strikes. Good luck, it may be worth it in the end.
> 
> 
> --- In amibro...@yahoogrou ps.com, "Edward Pottasch" <empottasch@ > wrote:
> >
> > thanks. Yes came across oan and read somewhere about repainting. Oan claims 
> > he makes tons of money with it. But repainting is basicly looking into the 
> > future. Hard to test such a system but will study it some more,
> > 
> > regards, Ed
> > 
> > 
> > 
> > ----- Original Message ----- 
> > From: conrad_faber 
> > To: amibro...@yahoogrou ps.com 
> > Sent: Friday, April 10, 2009 3:31 PM
> > Subject: [amibroker] Re: Gravity center mustafa Belkhayate
> > 
> > 
> > 
> > 
> > 
> > FWIW
> > 
> > The indicator that is used by oan on his FF benkyalate thread is based on 
> > the centre of gravity indicator of which there are two types. One repaints 
> > the past as new bars are formed (used by oan) and one does not. Not having 
> > used it myself I do not know which one your code relates to. Best to search 
> > FF forums.
> > 
> > Regards Conrad
> > 
> > --- In amibro...@yahoogrou ps.com, "Edward Pottasch" <empottasch@ > wrote:
> > >
> > > thanks,
> > > 
> > > yes similar to what you see on this video:
> > > 
> > > http://www.youtube. com/watch? v=zD_zIkEymE0
> > > 
> > > it plots the lines in real time but I can't see if it changes the lines 
> > > at a later stage when information poures in. I do not "speak" mql4 
> > > language therefor I ask. But it shouldn't be too hard to translate. If 
> > > somebody knows it will save me the effort.
> > > 
> > > regards, Ed
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ----- Original Message ----- 
> > > From: reinsley 
> > > To: amibro...@yahoogrou ps.com 
> > > Sent: Friday, April 10, 2009 1:56 PM
> > > Subject: Re: [amibroker] Gravity center mustafa Belkhayate
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > I have got a CD demo running with MetaTrader 4 platform.
> > > I did not checkin to get real time quotes, but on historical datas only 
> > > the last 150 bars can plot the GC.
> > > I did not count exactly, it's between 150 and 200 bars. Always the last 
> > > bars and the same number of bars, you cannot move the indicator in the 
> > > past, unless to remove datas.
> > > 
> > > So I suppose it looks into the future. We cannot have such a smooth 
> > > curve in the past and keep the same turning points.
> > > 
> > > Another Belkhayate Timing indicator was supplied but it hangs the PC.
> > > 
> > > However it worth to test it in real time before to write bad things 
> > > about it.
> > > 
> > > Best regards
> > > 
> > > Edward Pottasch a écrit :
> > > > 
> > > > 
> > > > 
> > > > looks interesting:
> > > > 
> > > > http://www.tradings ystemforex. com/expert- advisors- backtesting/ 
> > > > 219-belkhayate- expert-advisor. html 
> > > > <http://www.tradings ystemforex. com/expert- advisors- backtesting/ 
> > > > 219-belkhayate- expert-advisor. html>
> > > > 
> > > > did not try to translate it yet. Anyone know if this code looks into 
> > > > the 
> > > > future? Is this system of Belkhayate related to this filter:
> > > > 
> > > > http://codebase. mql4.com/ 2297 <http://codebase. mql4.com/ 2297>
> > > > 
> > > > ?
> > > > 
> > > > thanks,
> > > > 
> > > > regards, Ed
> > > > 
> > > > 
> > > > 
> > > > 
> > > > ----- Original Message -----
> > > > *From:* Michel Guibert <mailto:michelg14@ >
> > > > *To:* amibro...@yahoogrou ps.com <mailto:amibro...@yahoogrou ps.com>
> > > > *Sent:* Thursday, April 09, 2009 8:23 PM
> > > > *Subject:* [amibroker] Gravity center mustafa Belkhayate
> > > > 
> > > > Hi
> > > > 
> > > > The gravity center from Mustafa Belkhayate on Prorealtime is looking
> > > > close to the following code , anybody has an idea about converting
> > > > it in Amibroker ??
> > > > ============ ========= ========= ========= ========= ====
> > > > k=p3 // Variable p3= 65
> > > > 
> > > > de48=DPO[k*2] (close)
> > > > if de48=de48[1] and de48[1]=de48[ 2] and de48[2]<>de48[ 3] then
> > > > flag=1
> > > > endif
> > > > n=(k*2)-4
> > > > p=(n/2)-1
> > > > d100=DPO[n]( close)
> > > > moy100=close- d100
> > > > co=(moy100-moy100[ 1]+(close[ p])/n)*n
> > > > if flag[1]=1 and flag[2]=0 then
> > > > hh=co[1]
> > > > endif
> > > > if flag[1]=1 then
> > > > co=hh
> > > > endif
> > > > n=p3 mod 2
> > > > p=(p3-n)/2
> > > > p3=(2*p)+1
> > > > once x=0
> > > > w=abs((p-x)/ p)
> > > > w=w*w*w
> > > > w=(1-w)
> > > > w=w*w*w
> > > > x=x+1
> > > > if barindex=p3 then
> > > > a=0
> > > > b=0
> > > > e=0
> > > > for i=1 to p3
> > > > z=barindex-i+ 1
> > > > a=a+w[z]
> > > > b=b+w[z]*(i)
> > > > e=e+(i)*(i)* w[z]
> > > > next
> > > > endif
> > > > if barindex>p3 then
> > > > c=0
> > > > d=0
> > > > for i=1 to p3
> > > > z=barindex-i+ 1
> > > > c=c+co[p3+p- i]*w[z]
> > > > d=d+co[p3+p- i]*w[z]*( i)
> > > > next
> > > > endif
> > > > alpha=(a*d-b* c)/(a*e-b* b)
> > > > beta=(c*e-b* d)/(a*e-b* b)
> > > > lowess=alpha* (p+1)+beta
> > > > if barindex < p3*2 then
> > > > lowess=undefined
> > > > endif
> > > > 
> > > > zz = close - lowess
> > > > zzsigma = STD[p3](zz)
> > > > bb1 = lowess + zzsigma
> > > > bb2 = lowess +1.618* zzsigma
> > > > bb3 = lowess +2* zzsigma
> > > > bl1 = lowess - zzsigma
> > > > bl2 = lowess - 1.618* zzsigma
> > > > bl3 = lowess - 2* zzsigma
> > > > 
> > > > return lowess, bb1, bb2, bb3, bl1, bl2, bl3
> > > > 
> > > > 
> > > > ------------ --------- --------- --------- --------- --------- -
> > > > Internet Explorer 8 makes surfing easier. Get it now!
> > > > <http://go.microsoft.com/?linkid=9655265>
> > > > 
> > > >
> > >
> >
>





      

Reply via email to