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

[amibroker] Re: Detrend



PureBytes Links

Trading Reference Links

Dimitris,
An interesting idea.
i had been playing with the idea of detrending data to look at 
patterns. i tried a two way EMA of prices -- going forward and 
backwards, averaging the two values, and dividing the price by the 
result. Another alternative could be to somehow incorporate the 
linear regression slope for the whole period.
Something like the following....hope it's useful..the sawtooth 
oscillator can work on ordinary data. It looks better without the 
detrend graph, but to all intents and purposes, the oscillator shows 
the same fluctuations with the ordinary data as the 'detrended'. My 
boundary conditions need  some work. I'll be interested to see where 
you go with your idea.

/*sawtooth osc.detrended*/
/*detrend*/
EnableScript("VBScript");
<%  Close = AFL("close")
dt=Close
ub=UBound(dt)
for i = 0 to UBound (dt )
if i=0 then dt(i)=dt(i)end if
if i=ub then dt(i)=dt(i)end if
if ((i>0) AND (I<ub))then
alpha=ub+1
x=(alpha-2)/alpha
y=2/alpha
Ci1=dt(i-1)
dt(i)=((ci1*x) + dt(i)*y) 
end if 
Close(i)=Close(i)/dt(i)
next
    AFL("dtClose1") = Close
 Close = AFL("close")
dt=Close
ub=UBound(dt)
i=ub
while(i>-1)
if i=0 then dt(i)=dt(i)end if
if i=ub then dt(i)=dt(i)end if
if ((i>0) AND (I<ub))then
alpha=ub+1
x=(alpha-2)/alpha
y=2/alpha
Ci1=dt(i+1)
dt(i)=((ci1*x) + dt(i)*y) 
end if 
Close(i)=Close(i)/dt(i)
i=i-1
wend
AFL("dtClose2") = Close
%>
detrendedClose=(dtClose1+dtClose2)/2;

Graph0=x=detrendedClose;
/*sawtooth  oscillator
  z=z1=6;
H1=(Max(EMA(C,z),C));L1=(Min(EMA(C,z),C));
r1=H1-L1;
C1=abs(C-L1);
i=EMA((c1)/r1,z1);
e=.0001;f=.045;
i=IIf(i>(1-e),1,i);
i=IIf(i<f,0,i);
Graph1=i;*/

--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> 
wrote:
> If we remove the trend successfully, the price chart will be 
> transformed into an oscillator.
> Something is coming from the corner, stay tuned !!
> Dimitris Tsokakis


------------------------ 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/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/