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

[amibroker] AmiBroker RT trial question



PureBytes Links

Trading Reference Links

Since DEMA exceeds the price for some bars, a distorsion is 
introduced in the shape of the DEMA line.
This is the vulnerable spot of many Ti3 averages, they tend to 
oscillate and, for non proper parameters, they will give 
unrealistic results.
We may  narrow the Ti3 distorsion in accepted levels.
The following example will limit the Ti3 distorsion between the DEMA5
[minimum] and the DEMA20[maximum] distorsion levels.

// Maximum Ti3 distorsion in the range of DEMA5 to DEMA20 distorsions
L1=LastValue(Cum(1));D=100;DD=110;
C0=IIf(Cum(1)>L1-d,dd,d);
Plot(C0,"\nCLOSE",1,8);
PERIOD1=5;
PERIOD2=20;
S2=DEMA(C0,PERIOD2);
S1=DEMA(C0,PERIOD1);
Div1=100*(s1-C0)/LastValue(C0);MaxDiv1=LastValue(Highest(Div1));
Div2=100*(s2-C0)/LastValue(C0);MaxDiv2=LastValue(Highest(Div2));
Plot(S1,"",colorRed,8);z2=WriteVal(period2,1.0);z1=WriteVal
(period1,1.0);
Plot(S2,"",colorBrightGreen,8);
Title="Max Div for DEMA("+z1+") ="+WriteVal(MaxDiv1,1.2)
+"%"+", DEMA("+Z2+")="+WriteVal(Maxdiv2,1.2)+"%"+"\nThe parameter S 
should be";
//the Ti3 function
function T3(price,periods,s)
{
e1=EMA(price,periods);
e2=EMA(e1,Periods);
e3=EMA(e2,Periods);
e4=EMA(e3,Periods);
e5=EMA(e4,Periods);
e6=EMA(e5,Periods);
c1=-s*s*s;
c2=3*s*s+3*s*s*s;
c3=-6*s*s-3*s-3*s*s*s;
c4=1+3*s+s*s*s+3*s*s;
Ti3=c1*e6+c2*e5+c3*e4+c4*e3;
return ti3;
}
//the S_range procedure
procedure S_range(x)
{
k=0;smin=0;step=0.01;
for(s=0.5;s<1.5;s=s+step)
{
Ti3=T3(C0,X,s);
Div3=100*(Ti3-C0)/LastValue(C0);MaxDiv3=LastValue(Highest(Div3));
if(MaxDiv3>=MaxDiv1 AND MaxDiv3<=MaxDiv2)
{
Plot(Ti3,"\nT3",colorLightBlue,1);
k=k+1;
smin=smin+IIf(k==1,s,0);
}
}
smax=smin+(k-1)*step;
Title=Title+"\nfor Ti3("+WriteVal(x,1.0)+")  from "+WriteVal(smin,1.2)
+" to "+WriteVal(smax,1.2);
}
//Application
for(x=PERIOD1;x<=PERIOD2;x=x+5)
{
S_range(x);
}
Title=Title+"\n\nSpecific application";
//Specific application
S_range(16);

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 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> 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/