EA

4 replies

MasterSye

Subscriber, bbp_participant, community, 80 replies.

Visit profile

8 years ago #114183

Hi. Can anyone provide a sample code or logical operation where EA detects high impact news and avoids trading during the release? I know such may need a custom indicator like FF cal, and I have a copy of it. It’s just that I don’t know how to go around using it in the EA wizard. Any suggestion is greatly appreciated. Thanks in advance.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #132592

This is not a standard function EA Wizard would support. You can try to measure time difference between ticks but it does not say anything since you can have high volatility environment – very fast market and still no news and reports. This would be very difficult or maybe impossible to achieve using Wizard.

 

Other option would be editing directly your MQ4 strategy. Using some XML parsing functions in MQL4 and this forexfactory XML feed http://www.forexfactory.com/ffcal_week_this.xml you could read oncoming news and avoid trading at those times

0

MasterSye

Subscriber, bbp_participant, community, 80 replies.

Visit profile

8 years ago #132611

Hi Tomas. Thanks for replying. I found this piece of code for the news filter. Can you please check if I could use it? If so, where do you think I should place it inside the generated code? 

 

extern bool AvoidNews=true;
extern int MinimumImpact=1;
extern int MinsBeforeNews=30;
extern int MinsAfterNews=30;

 

bool ContinueTrading=true;
if(AvoidNews)
{
static int PrevMinute=-1;

int MinSinceNews=iCustom(NULL,0,”FFCal”,true,true,false,true,true,1,0);
int MinToNews=iCustom(NULL,0,”FFCal”,true,true,false,true,true,1,1);

int ImpactSinceNews=iCustom(NULL,0,”FFCal”,true,true,false,true,true,2,0);
int ImpactToNews=iCustom(NULL,0,”FFCal”,true,true,false,true,true,2,1);

if(Minute()!=PrevMinute)
{
PrevMinute=Minute();
if((MinToNews=MinimumImpact) || (MinSinceNews=MinimumImpact))ContinueTrading=false;
}

}

 

it says that in each entry conditions, below should be added:

 

&& ContinueTrading

 

Thanks in advance for any help you can provide me. 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #132720

You could add this right before // Entry Long line and then add && ContinueTrading into long/short conditions

You have to also install FFCal indicator into MetaTrader to make it work

0

MasterSye

Subscriber, bbp_participant, community, 80 replies.

Visit profile

8 years ago #132729

I have several rules in my strategy. Do I place that same code in every long rule?

0

Viewing 4 replies - 1 through 4 (of 4 total)