i did some test and i works fine but it turns out the data of the mql5 calendar is very delayed.
i use the ID of the event to let the EA look at the prev , forecast and actual data.
With the delayed my trade start to late and the biggest movement allready happend.
Someone any idea how i can solve this problem? Is there another way? i allready did downloading the Calendar file from forexfactory (try to use there calendar), but there is no actual data so thats not gonna work.
Anyone who can help me ?
MqlCalendarValue values[];
MqlDateTime dt;
TimeCurrent(dt);
// datetime StartTime = TimeCurrent()-(PERIOD_D1*Print_StartTime);// datetime EndTime = TimeCurrent()+PERIOD_D1*(Print_EndTime);CalendarValueHistory(values,StartTime,EndTime,NULL,NULL);
for(int i = 0; i < ArraySize(values); i++){
MqlCalendarEvent event;
CalendarEventById(values[i].event_id,event);
MqlCalendarCountry country;
CalendarCountryById(event.country_id,country);
if((StringFind(_Symbol,country.currency) >= 0 ) || (event.type == 0) ){
if(event.importance >= Importante_minimaal && event.importance <= Importante_miximaal){
if(values[i].id == Event1 && Event1 !=0 ){
Event1Name = event.name;
Event1_ID = values[i].id;
Event1Time = values[i].time;
//double
Event1PrevRevised = values[i].revised_prev_value;
Event1Prev = values[i].prev_value;
Event1Forecast = values[i].forecast_value;
Event1Actual = values[i].actual_value;
Event1Currency = country.currency;
Event1Time = values[i].time;
Event1_Impact = values[i].impact_type;
// bool
}
if(Event1 == Event1_ID && Event1 != 0){
if(Event1Currency != Currency_Base && Event1Currency != Currency_Profit)
{Alert("Event behoord niet in deze chart");
returnfalse ;} {
Print("GESELECTEERDE EVENT: ", Event1Name, " ID: ",Event1_ID,
" CURRENCY: ",Event1Currency," TIME: ",Event1Time);}
// Is het event van het eerste symbol op de chartif(Event1Currency==SymbolInfoString(_Symbol,SYMBOL_CURRENCY_BASE)){
Print(" EVENT 1 IS BASE SYMBOL ",SymbolInfoString(_Symbol,SYMBOL_CURRENCY_BASE));
if (
TimeCurrent(dt) >= Event1Time-Event1_check_data_before_launch_in_Minutes*PeriodSeconds(PERIOD_M1) &&
TimeCurrent(dt) <= Event1Time+Event1_check_data_after_launch_in_Minutes*PeriodSeconds(PERIOD_M1))
{
Print("Actual DATA voor ",SymbolInfoString(_Symbol,SYMBOL_CURRENCY_BASE), " word opgehaald!");
Print("Act: ",Event1Actual," Forecast: ",Event1Forecast," Prev: ",Event1Prev);
if (Event1Actual != -LONG_MIN){
if(ValuesOnline ==D'1987.03.31 00:00:00'){ValuesOnline=TimeCurrent(dt);}
// als de actuele cijfers beter zijn dan voorspeldif (Event1Actual > Event1Forecast ) {
if(CountBuy < Max_Buy_Trades){
Comment("Actuele cijfers zijn beter dan voorspeld van",Event1Name);
Comment("BUY MOMENT");
Comment(" Actual: ",Event1Actual," Forecast: ",Event1Forecast," Prev: ",Event1Prev);
Open_Buy();
}
if (CountBuy>=Max_Buy_Trades){
Print(" Maximale BUY trades is bereikt"); }
}
// als de actuele cijfers slechter zijn dan voorspeldif(Event1Actual<Event1Forecast) {
if(CountSell < Max_Sell_Trades){
Print("Actuele cijfers zijn slechter dan voorspeld of dan de vorige data");
Print("SELL Word geopend");
Print(" Actual: ",Event1Actual," Forecast: ",Event1Forecast," Prev: ",Event1Prev);
Open_Sell();
}
if(CountSell>= Max_Sell_Trades){
Print(" Maximale Sell Trades is bereikt"); }
}
if(Event1Actual==Event1Forecast){
Print(" Actual is hetzelfde als forcast");
}
} // if Actual != LONG MIN
}//TimeCurrent, Data word opgehaald en // START EEN TRADE//// Gebruik Prev data
}// Is event currency de base currency// Is het event van het TWEEDE symbol op de chartif(Event1Currency==SymbolInfoString(_Symbol,SYMBOL_CURRENCY_PROFIT)){
Print(" EVENT 1 IS PROFIT SYMBOL ",SymbolInfoString(_Symbol,SYMBOL_CURRENCY_PROFIT));
// if (TimeCurrent() >= Event1Time-Event1_check_data_before_launch_in_Minutes*PeriodSeconds(PERIOD_M1))// { Print("Actual DATA voor " ,SymbolInfoString(_Symbol,SYMBOL_CURRENCY_PROFIT) ," word opgehaald!");}
}// Is Event Currency de Profit Currency
}// Is Event1ID gelijk aan het ingevoerde Event
}// EVENT IMPORTANCE
}// Chart is gelijk aan de Country Currency || Gelijk aan Zeer belangrijk Nieuws
}// Loopreturnfalse;}
Hey all!
im trying to build some nice EA for news trading.
i did some test and i works fine but it turns out the data of the mql5 calendar is very delayed.
i use the ID of the event to let the EA look at the prev , forecast and actual data.
With the delayed my trade start to late and the biggest movement allready happend.
Someone any idea how i can solve this problem? Is there another way? i allready did downloading the Calendar file from forexfactory (try to use there calendar), but there is no actual data so thats not gonna work.
Anyone who can help me ?