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

[amibroker] Inverse functions



PureBytes Links

Trading Reference Links




We usually express an MA or an EMA or a DEMA as a function of 
Close.
The inverse functions are interesting in T/A 
studies.
Paste in an indicator builder window the verification 
formula
 
// Inverse functions, by D. Tsokakis, Aug 
2003
p=20;fp=<FONT 
size=2>2/(p+1<FONT 
face=Verdana size=2>);<FONT 
face="Times New Roman">
CloseviaMA=p*MA<FONT 
size=2>(C,p)-(p-1)*<FONT 
size=2>Ref(MA<FONT 
size=2>(C,p-1),-<FONT 
size=2>1);// 
[1]
CloseviaEMA=0.5*((P+<FONT 
size=2>1)*EMA<FONT 
size=2>(C,P)-(P-1)*<FONT 
size=2>Ref(EMA<FONT 
size=2>(C,P),-1<FONT 
face="Times New Roman">));// [2]
CloseviaDEMA=(DEMA<FONT 
size=2>(C,p)+(1-fp)*fp*<FONT 
size=2>Ref(EMA<FONT 
size=2>(C,p),-1)-(<FONT 
size=2>1-fp)*Ref<FONT 
size=2>(DEMA(C,p),-<FONT 
size=2>1))/((2<FONT face=Verdana 
size=2>-fp)*fp);// [3]<FONT 
face=Verdana size=2>
Plot(C,"CLOSE"<FONT 
size=2>,1,<FONT 
size=2>1<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
Plot(CloseviaMA,<FONT 
size=2>"CloseviaMA",5<FONT 
size=2>,1<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
Plot(CloseviaEMA,<FONT 
size=2>"CloseviaEMA",7<FONT 
size=2>,1<FONT 
face="Times New Roman">);<FONT 
face="Times New Roman">
Plot(CloseviaDEMA,<FONT 
size=2>"CloseviaDEMA",4<FONT 
size=2>,1<FONT 
face="Times New Roman">);
 
As an application 
you may have the nextbarClose as a function of nextbarMA or nextbarEMA or 
nextbarDEMA.
<FONT 
face="Times New Roman">Example: