I developped a multitimeframe (1 and 60 min) strategy and I meet a problem.
I write this in onBarUpdate:
I store in a doubles variables the hour information
if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired)
return;
if(BarsInProgress == 1)
{
ema10=EMA(Close,mov10Hour)[0];
ema50=EMA(Close,mov50Hour)[0];
midband=MyPchannelBand(20,1.6,3.2,4.8, 20).Midband[0];
bandplus=0;
bandmoins=MyPchannelBand(20,1.6,3.2,4.8, 20).BandMoins2[0];
}
After I wrote my enter condition (always in the onBarupdate of course:
if(midband>ema10)
{
if(High[0]>ema10 && Open[0]<ema10 && ema10>bandmoins)
{
EnterLong(100000, "B1");
long_b1=1;
}
At the begining the backtest work well, the system enter and exit well and some time it do a false trade like:
It enter at 17:00 and exit at 16h00 and more if I look the graph the conditions are wrong.
I d'on't understand the problem,
Could you help me please?
Thank's for your help.

Comment