View Single Post
  #20 (permalink)  
Old 10-13-2005, 08:18 PM
quksilver quksilver is offline
Junior Member
 
Join Date: Oct 2005
Posts: 14
quksilver is on a distinguished road
Actually, I don't think that expert is quite right. In the original code, the T3MA was calculated differently.

e1:=Mov(price,Periods,E);
e2:=Mov(e1,Periods,E);
e3:=Mov(e2,Periods,E);
e4:=Mov(e3,Periods,E);
e5:=Mov(e4,Periods,E);
e6:=Mov(e5,Periods,E);

Each one is a moving average of the previous one.

double e1=iMA(NULL,0,Periods,0,MODE_EMA,PRICE_CLOSE,0);
double e2=iMA(NULL,0,Periods,0,MODE_EMA,e1,0);
double e3=iMA(NULL,0,Periods,0,MODE_EMA,e2,0);
double e4=iMA(NULL,0,Periods,0,MODE_EMA,e3,0);
double e5=iMA(NULL,0,Periods,0,MODE_EMA,e4,0);
double e6=iMA(NULL,0,Periods,0,MODE_EMA,e5,0);

In this expert, I'm not sure what these will return. Putting the previous variable into the place that's supposed to identify the type of price to use (i.e. PRICE_CLOSE, PRICE_OPEN, etc) isn't going to make a moving average of the previous variable. It's just going to be nonsense.

Instead, I think you have to do something like this:

double e1[];
double e2[];
double e3[];
double e4[];
double e5[];
double e6[];

for (int i=0;i<Periods;i++) e1[i]=iMA(NULL,0,Periods,0,MODE_EMA,PRICE_CLOSE,i);

for (i=0;i<Periods;i++)
e2[i]=iMAonArray(e1,Periods,...can't remember the other inputs to iMAonArray...)

etc...repeat for each array.

-lcg
Reply With Quote