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

[amibroker] Re: Dimitris Tsokakis



PureBytes Links

Trading Reference Links

Hello,

Very interesting articles.
I read the posts on AB forum about this(cross by DT and post by Fred 
about computing cross possibility by iterative procedure given a 
tolerance number).
Very nice topics booth from 2003-2004.
Now year passed, and it seems we are finding some of those algo in 
newspaper héhé : ))
Maybe we can try to go a little further now.

DT prediction is based on computing the min (or max) future close 
needed to achieve a cross of the 2 MA at the time of this future 
close.
The assumption is : if the actual close as already cross this 
necessary min/max value, so the close will append at next close....
but it is only true if price is maintain under this min/max value.
But if price move again and cross this min/max value for the next 
bar, so the prediction is bad... the MA cross don't happend, but the 
cross was predicted one bar ago.

This is one technic to predict. There are many other.

I was interrested in comparing this very good technics by some more 
easy to generalize technics.
So i made some prediction based on what is thinked as to be the best 
predictor at t+1: the linear predictor.
Very old technic, and easy to apply.
P[t+1] = P[t] + (Value Difference between t and t-1)
so P[t+1] = P[t] + (P[t] - P[t-1])
so P[t+1] = 2*P[T] - P[t-1];

By comparing result againt DT cross, i find prediction was not so bad.
But miss all the cross wich are predicted at the same time the cross 
occurs. So i add a small check for this at the end.
Code is at the end of this msg.

To finish prediction seems good, sometimes wrong.
DT cross are very good, but wrong sometimes too.
Booth prediction aren't wrong for the same conditions, so to make a 
more accurate prediction we can merge the 2 predictors and keep only 
the cross predicted by booth at the same time.

What is good with our classic linear predictor is that it can be used 
to predict any array number even if we don't know how to construct it 
or the model behind those array.
We can even think of a predictor of DT cross, so we can predict à T-2 
the cross : )))


Thanks a lot dimitris for your very good work !
Seems you where on this list before, but somethings happen, so you go 
away.
Maybe one day you can change your mind, and come back here.


Cheers,
Mich.


Code is below for DEMA cross :
--------------------------------------------------------------
/*
cross based on classic linear prediction to +1
*/

// Choice of the parameters
data_source = ParamField("Price field",-1);
DEMAST  = Param("Dema 1", 20, 1, 200, 1);
DEMALT  = Param("Dema 2", 30, 1, 200, 1);

// Initialization
SetBarsRequired(20000,0);
data = data_source;

up = 0;
down = 0;

DEMAS = DEMA(data_source, 20);
DEMAL = DEMA(data_source, 30);

// predict dema1
DEMASP = 2*DEMAS - Ref(DEMAS,-1);

// predict dema2
DEMALP = 2*DEMAL - Ref(DEMAL,-1);

// predict demacross for t+1
predict_up = ( DEMASP - DEMALP > 0 ) AND ( DEMAS - DEMAL < 0 );
predict_down = ( DEMASP - DEMALP < 0 ) AND ( DEMAS - DEMAL > 0 );

// if cross occurs but was not detected (at t-1 and/or t-2) so cross 
is said to be predicted on the same bar than the cross really occurs
real_up = Cross(DEMAS,DEMAL);
real_down = Cross(DEMAL,DEMAS);
predict_up = IIf( real_up AND NOT(Ref(predict_up,-1)) AND NOT(Ref
(predict_up,-2)), 1, predict_up);
predict_down = IIf( real_down AND NOT(Ref(predict_down,-1)) AND NOT
(Ref(predict_down,-2)), 1, predict_down);

// plot result
Plot(C,"C",colorDarkBlue,64);
PlotShapes(shapeUpArrow*real_up,colorBrightGreen);
PlotShapes(shapeDownArrow*real_down,colorRed);
PlotShapes(shapeDownTriangle*predict_down,colorPink,0,Graph0,-30);
PlotShapes(shapeUpTriangle*predict_up,colorPaleGreen,0,Graph0,-30);

GraphXSpace=4;
----------------------------------------------------------



--- In amibroker@xxxxxxxxxxxxxxx, "john_dxd_smith" 
<john_dxd_smith@xxx> wrote:
>
> 
> Dimitris Tsokakis is live and well.
> 
> See his article "Anticipating Moving Average Crossovers" in February
> 2007 issue of Technical Analysis of STOCKS & COMMODITIES.
> 
http://www.traders.com/Documentation/FEEDbk_docs/Abstracts_new/Tsokaki
s/tsokakis.html
>



Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.14/637 - Release Date: 1/18/2007 1:03 PM