Hi Igor, I'm still trying to modify the ea that I downloaded from this topic because I like it a lot and I like the possibility to make a backtest. Would you help me modify it? I need it to trade after the bar where the news has been released is closed so that it can put a buy stop and a sell stop order over the top and under the minimum of the closed bar.
I can't find a way to change the folllowing code to tell the ea to consider the last news release time.
Code:
datetime TimeToOpen()
{
int i;
double procTime;
datetime result;
if(ECN_Mode) procTime = OrderDuration; else procTime = ProcessTime;
for (i=0;i<=NewsNum;i++)
{
datetime oTime = (datetime)(dt[i] - TimeGap*60);
if(TimeCurrent() >= oTime && TimeCurrent() <= oTime + procTime*60 && oTime >= pEventTime)
{
result = oTime;
break;
}
}
return(result);
}
//-----
bool IsNewEvent()
{
bool result = false;
for (int i=0; i < NewsNum; i++)
{
datetime oTime = (datetime)(dt[i] - TimeGap*60);
if(TimeCurrent()>= oTime && oTime > pEventTime)
{
result = true;
pEventTime = oTime;
break;
}
}
return(result);
}
Thank you for this great EA