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

Re: [amibroker] ignore extra buy signals



PureBytes Links

Trading Reference Links

We suppose again the price move from 100 to 110 in one day.
The DEMA/TEMA averages will exceed the final price by MaxDiv1/MaxDiv2 
respectively.
The question is to find the range of parameter s which will cause to 
Ti3 smoother a MaxDiv3 with

MaxDiv1<= MaxDiv3 <=MaxDiv2

The following IB code will find

// The parameter s limitations  
L1=LastValue(Cum(1));D=100;DD=110;
C0=IIf(Cum(1)<L1-D,D,DD);
Plot(C0,"\nCLOSE",1,8);
PERIOD=20;z=WriteVal(period,1.0);
S1=DEMA(C0,PERIOD);
S2=TEMA(C0,PERIOD);
Div1=100*(s1-C0)/LastValue(C0);MaxDiv1=LastValue(Highest(Div1));
Div2=100*(s2-C0)/LastValue(C0);MaxDiv2=LastValue(Highest(Div2));
Plot(S1,"\nDEMA",colorRed,1);
Plot(S2,"\nTEMA",colorBrightGreen,1);
Title="Maximum Divergence for \nDEMA("+z+") ="+WriteVal(MaxDiv1,1.2)
+"%"+"\nTEMA("+z+")="+WriteVal(Maxdiv2,1.2)+"%";
function T3(price,periods,s)//According to Jayson message 59811 
{
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;
}
X=Param("X",5,3,20,1);
for(s=0.7;s<1;s=s+0.01)
{
Ti3=T3(C0,X,s);
Div3=100*(Ti3-C0)/LastValue(C0);MaxDiv3=LastValue(Highest(Div3));
if(MaxDiv3>=MaxDiv1 AND MaxDiv3<=MaxDiv2)
{
Plot(Ti3,"\nT3",colorBlue,1);
Title=Title+"\nTi3("+WriteVal(x,1.0)+") [s="+WriteVal(s,1.2)+"]
="+WriteVal(maxDiv3,1.2)+"%";
}
}

EXAMPLE
For Ti3(10) s should be in the range [0.70-0.79]
For Ti3(5) s should be in [0.77-0.87]

s values above this range will cause significant perturbation of the 
Ti3 smoother and will introduce probable oscillation.
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> 
wrote:
> Let us suppose a stock goes from 100 to 110 in one day.
> We shall examine the response of DEMA, TEMA and Ti3 averages.
> These smoothers catch the new price in some days, then go higher 
and 
> find again [asymptotically] the final price.
> For a given DEMA/TEMA period we may calibrate the Ti3 period to 
> obtain the same Maximum Divergence from the final price.
> EXAMPLE
> For DEMA/TEMA period=20, we need Ti3 periods  x=4 and x=7 
> respectively to avoid exceeding the DEMA/TEMA MaxDiv.
> 
> // Ti3 crash test and Maximum Divergence, by D. Tsokakis, March 2004
> function T3(price,periods)//According to Jayson´s message 59811 
> {
> s = 0.83;
> 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;
> }
> L1=LastValue(Cum(1));D=100;DD=110;
> C1=IIf(Cum(1)<L1-D,D,DD);
> Plot(C1,"\nCLOSE",1,8);
> PERIOD=20;
> S1=DEMA(C1,PERIOD);
> S2=TEMA(C1,PERIOD);
> X=Param("X",3,3,20,1);
> Ti3=T3(C1,X);
> //The maximum divergence
> Div1=100*(s1-C1)/LastValue(C1);MaxDiv1=LastValue(Highest(Div1));
> Div2=100*(s2-C1)/LastValue(C1);MaxDiv2=LastValue(Highest(Div2));
> Div3=100*(Ti3-C1)/LastValue(C1);MaxDiv3=LastValue(Highest(Div3));
> Plot(S1,"\nDEMA",colorRed,1);
> Plot(S2,"\nTEMA",colorBrightGreen,1);
> Plot(Ti3,"\nT3",colorBlue,1);
> z=WriteVal(period,1.0);
> Title="Maximum Divergence for \nDEMA("+z+") ="+WriteVal(MaxDiv1,1.2)
> +"%"+"\nTEMA("+z+")="+WriteVal(Maxdiv2,1.2)+"%"+"\n     Ti3
("+WriteVal
> (x,1.0)+")="+WriteVal(maxDiv3,1.2)+"%";



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/