Finally, News Filter for MT5 in 1 easy to use Block !!
-
@morteza-alishahi Is it working for you?
-
is doesn't work @QuantEngineer

-
Work fine, but need adjusts.
-
@OntradingX Could you please tell me how you create this filter step by step?
-
@OntradingX What adjusts are required? Could you send a screenshot?
-
What tutorial are you speaking about? You give zero help or explenation, might as well have spoken chinese same outcome....
-
below complete code:
/*
int minbeforeEvent = 6024;
int minAfterEvent = 6024;
string currency_code = "";
string country_code=NULL; //--- country code (ISO 3166-1 Alpha-2)
ENUM_CALENDAR_EVENT_IMPORTANCE min_event_importance = CALENDAR_IMPORTANCE_HIGH;
*/int FilteredEventsCount = 0;
MqlCalendarValue values[];
//--- set the boundaries of the interval we take the events from
datetime date_from=TimeCurrent() - (60minbeforeEvent);
datetime date_to=TimeCurrent() + (60minAfterEvent); // 0 means all known events, including the ones that have not occurred yet
//Print(TimeToString(TimeCurrent(), TIME_DATE|TIME_SECONDS), " -> Searching from ", TimeToString(date_from, TIME_DATE|TIME_SECONDS), " to ", TimeToString(date_to,TIME_DATE|TIME_SECONDS));
//--- request event history since the beginning to future time//if(verbose) Print("Begin Searching for events from " + TimeToString(date_from,TIME_DATE|TIME_SECONDS) + " to " + TimeToString(date_to,TIME_DATE|TIME_SECONDS) + " For Country " + country_code + ", currency " + currency_code );
if(!CalendarValueHistory(values, date_from, 0, country_code, currency_code))
{
PrintFormat("Error! Failed to get events for country_code=(%s), currency=(%s)", country_code, currency_code);
PrintFormat("Error code: %d", GetLastError());} else {
//if(verbose) Print("Found some events");
//PrintFormat("Received event values for country_code=(%s), currency=(%s) is (%d)", country_code, currency_code, ArraySize(values));
int total=ArraySize(values);
string commentString = "";
for(int i=0; i<total; i++)
{
//if(values[i].impact_type < )
MqlCalendarEvent event;
ulong event_id=values[i].event_id;
if(CalendarEventById(event_id,event))
{
if(((ENUM_CALENDAR_EVENT_IMPORTANCE)event.importance >= min_event_importance )
&& (values[i].time <= date_to)
)
{
FilteredEventsCount++;commentString = commentString + TimeToString(values[i].time,TIME_DATE|TIME_SECONDS) + " " + event.name + " " + EnumToString((ENUM_CALENDAR_EVENT_IMPORTANCE)event.importance ) + "\n"; } } }commentString = "MQL5 returned " + FilteredEventsCount + " events from " + TimeToString(date_from,TIME_DATE|TIME_SECONDS) + " to " + TimeToString(date_to,TIME_DATE|TIME_SECONDS) + " For Country " + country_code + ", currency " + currency_code + "\n" + commentString;
if(verbose) Comment(commentString);
}
if( FilteredEventsCount > 0 )
{~next~}
else
{~inext~}BELOW, CODE TO INSERT IN GLOBAL VARIABLES:
string event_info = "";AND, NEED CREAT THIS:

BELOW CONFIGURATIONS:






AND TO FINISH INSERT THIS BUTTON CREATED IN ON TICK OR ON TIMER

Hope this helps someone.
-
@OntradingX Thanks, appreciate the support but I'm still struggling.
Copying the code & instructions above I get this error:

Also, is the last parameter Datatype ENUM_CALENDAR_EVENT_IMPORTANCE ?
Thanks
-
@Dre please, print your screen (constants and variables) here
-
@Dre ENUM_CALENDAR_EVENT_IMPORTANCE is correct
-

-
-
segui exatamente oque esta ai não deu nenhum erro porem nao aparece nenhum evento no grafico como posso saber se funciona ou não ?
e como posso usar as regras dele para desligar o botão negociação automatica antes do evento e voltar a ligar após o evento envez de abrir uma order de compra ou venda me explica ai por favor oque esta acontecendo -
@lucas-farias-de-almeida Oi lucas, para que isto funcione adequadamente são vários passos, inclusive um que talvez esteja faltando ai do seu lado é o do bloco comentário para exibir os dados da noticia. Me chame no reservado e talvez eu possa lhe ajuda no telegram.
-
@Dre said in Finally, News Filter for MT5 in 1 easy to use Block !!:
I'm still struggling.
I'm still struggling too. @OntradingX
Please help !! -
@OntradingX Ciao ,
Hi is working very well i think there is a simple mistakeMinuteBeforeEvent act like MinuteAfterEvent so it's inverted.
i think in this code we need to change + with -
datetime date_from=TimeCurrent() - (60 * minbeforeEvent);
datetime date_to=TimeCurrent() + (60 * minAfterEvent);so
datetime date_from=TimeCurrent() + (60 * minbeforeEvent);
datetime date_to=TimeCurrent() - (60 * minAfterEvent);I'm wrong ?
Thank'sedit :
I try to invert + and - but now will display nothing, for now i invert the parameters that i will pass. -
@lucag you is correct, great information.
-
- Hey mates! Thank you for doing this!
Since this topic is so popular, could anyone shot a step-by-step video tutorial on how a News filter is built w/ FXStudio and post it in this thread - I believe it would be much appreciated by the community, especially by those having less experience w/ FXStudio and Custom Block building. Thank you!

- Hey mates! Thank you for doing this!
-
how to filter All day event ?
-
@abinfoappp write ALL

