Hi all,
I'm trying to replicate a multi-time frame stoch ea.
But every 4 hours the stochs for H4, 1 and M15 are the same. I understand how they could be the samae, but every 4 hours seems wrong.
I've looked and looked and don't see a problem, but there has to be one.
Thanks for any help.
P

#define D1 (1440/BarPeriod)
#define H4 (240/BarPeriod)
#define H1 (60/BarPeriod)
#define M15 (15/BarPeriod)

function run()
{
BarPeriod = 15;
TimeFrame=H4;
vars PriceH4=series(price());
StochF(5,3,MAType_SMA);
vars StoH4=series(rFastK);
TimeFrame=H1;
vars PriceH1=series(price());
StochF(5,3,MAType_SMA);
vars StoH1=series(rFastK);
TimeFrame=M15;
vars PriceM15=series(price());
StochF(5,3,MAType_SMA);
vars StoM15=series(rFastK);
Lots=1;
StartDate=20080102;
EndDate=20080631;
Margin=0;
Spread=2*PIP;
set(LOGFILE|PLOTNOW|PLOTPRICE);

Asset=("AUDUSD");

printf("# \n");
printf("# Price Stoc \n");
printf("# H4 %5.5f %5.5f \n", PriceH4[0],StoH4[0]);
printf("# H1 %5.5f %5.5f \n", PriceH1[0],StoH1[0]);
printf("# M15 %5.5f %5.5f \n", PriceM15[0],StoM15[0]);

//Oversold
if((NumOpenTotal<2)&&(StoH4[0]<20)&&(StoH1[0]<20)&&(StoM15[0]<20)) {
exitShort();
enterLong();
}

//Overbought
if((NumOpenTotal<2)&&(StoH4[0]>80)&&(StoH1[0]>80)&&(StoM15[0]>80)) {
exitLong();
enterShort();
}

plot("StoH4",StoH4[0],NEW,RED);
plot("StoH1",StoH1[0],NEW,BLUE);
plot("StoM15",StoM15[0],NEW,GREEN);

}