View Single Post
  #30 (permalink)  
Old 01-25-2008, 03:38 PM
igorad's Avatar
igorad igorad is offline
Senior Member
 
Join Date: Oct 2005
Location: Ukraine
Posts: 796
igorad is on a distinguished road
Quote:
Originally Posted by syedks View Post
I am working on a EA that I want to stop trading 2 hours before news come out and wait for another hour after, for any of the symbol the EA is attached to. for example if this ea is attached to GBPUSD chart then any news related to GBP or USD which is of high importance should get picked up by this ea and stop trading based on the time of the news ... can anyone please help?

thanks heaps in advance.
Try to use slightly different function TimetoOpen()(from NewsTrader) in your EA:

bool TimeToOpen()
{
bool result = false;
for (int i=0; i<=NewsNum; i++)
{
datetime OpenTime = dt[i] - TimeGap*60; //ex. 2h = 120

if((TimeCurrent() < OpenTime && TimeCurrent() >= OpenTime+TimeGap*60))
{result=true; break;}
}
return(result);
}

Сall of this function you should place in the main condition of orders opening.

Ex. if (MA1>MA2.... && TimeToOpen()) ...
__________________
Let's improve trade skills together
http://finance.groups.yahoo.com/group/TrendLaboratory

Last edited by igorad; 01-26-2008 at 06:48 AM.
Reply With Quote