fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Finally, News Filter for MT5 in 1 easy to use Block !!

    Tutorials by Users
    31
    74
    15785
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q
      QuantEngineer last edited by

      When they decide to allow sharing custom blocks, I will share this block here... a lot of people like it...

      Quant Engineer
      www.abfs.tech

      T T 2 Replies Last reply Reply Quote 0
      • T
        TXZZ @QuantEngineer last edited by

        Thank you.

        1 Reply Last reply Reply Quote 0
        • R
          RoboPicker last edited by

          Really looking forward to this!

          1 Reply Last reply Reply Quote 0
          • T
            tec.nacks @QuantEngineer last edited by

            @quantengineer Hello, you can share the code in steps instead of we waiting for custom blocks to be shared...just like this tutorial

            https://fxdreema.com/forum/topic/5866/finally-integration-of-news-filter-mt4-only?page=1

            1 Reply Last reply Reply Quote 0
            • jstap
              jstap @QuantEngineer last edited by

              @quantengineer Maybe this is something that admin will add, for now though you could add the text here and say what part it's added to, then the next section etc.

              Learn fxDreema Without the Wait!

              My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

              The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

              Don’t miss out

              Click here➡️ https://mybook.to/fxDreema to get your copy today!

              Enjoy! 😊

              1 Reply Last reply Reply Quote 0
              • M
                mk8813 last edited by

                You have done a great job sir. @QuantEngineer
                If possible, share a short video of the build process so that others can rewrite it.

                1 Reply Last reply Reply Quote 0
                • K
                  kimkim999 last edited by

                  @QuantEngineer Thanks for sharing this great method! can i have the code as well?

                  1 Reply Last reply Reply Quote 0
                  • Q
                    QuantEngineer last edited by

                    Hello Developers, I am happy to announce that I have done some improvements to this code and now it also displays the events on the chart, for reference...

                    Here is how the block looks like
                    fbd1ea6f-6967-488f-a71a-1e412ce39968-image.png

                    Enjoy the latest main code

                    /*
                    int minbeforeEvent = 60*24;
                    int minAfterEvent = 60*24;
                    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() - (60*minbeforeEvent);  
                    datetime date_to=TimeCurrent() + (60*minAfterEvent);                // 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~}
                    

                    Quant Engineer
                    www.abfs.tech

                    L 1 Reply Last reply Reply Quote 2
                    • Q
                      QuantEngineer last edited by

                      And here is how the chart will look like, in case the verbose mode is set to true

                      image.png

                      Quant Engineer
                      www.abfs.tech

                      OntradingX 1 Reply Last reply Reply Quote 4
                      • K
                        kimkim999 last edited by

                        @QuantEngineer Thanks alot for the update!!

                        1 Reply Last reply Reply Quote 0
                        • l'andorrà
                          l'andorrà last edited by

                          Impressive work. Thank you very much!

                          (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

                          (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

                          (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

                          1 Reply Last reply Reply Quote 0
                          • Q
                            QuantEngineer last edited by

                            Thank you for the kind words of cheering, I appreciate your comments.

                            Quant Engineer
                            www.abfs.tech

                            1 Reply Last reply Reply Quote 0
                            • N
                              nk0815 last edited by nk0815

                              Thank you for providing this, @QuantEngineer

                              I pasted your latest code into the Studio, and created the parameters from the "out-commented" beginning of your code.

                              When I add the block to my project, however, it is empty. Am I missing something?

                              Screenshot (230).png

                              Screenshot (228).png

                              1 Reply Last reply Reply Quote 0
                              • Q
                                QuantEngineer last edited by

                                Hello @nk0815 , the issue that you are describing is related to how you are creating the "Parameters used in Block"... Look for some tutorials about this area of FXDreema Studio or learn about TYPES and you should be able to resolve that. I wish you a good week.

                                Quant Engineer
                                www.abfs.tech

                                1 Reply Last reply Reply Quote 0
                                • L
                                  lucas farias de almeida @QuantEngineer last edited by

                                  @QuantEngineer said in Finally, News Filter for MT5 in 1 easy to use Block !!:

                                  /*
                                  int minbeforeEvent = 6024;
                                  int minAfterEvent = 60
                                  24;
                                  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() + (60
                                  minAfterEvent); // 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~}

                                  1 Reply Last reply Reply Quote 0
                                  • OntradingX
                                    OntradingX @QuantEngineer last edited by

                                    @QuantEngineer First I would like to thank you for sharing this wonderful code.
                                    Secondly, I wanted to ask you, is there any way to implement this code so that it is possible to backtest the news data from the past?

                                    Sou do Brasil e utilizo o sistema Fxdreema a alguns anos, sempre que tenho tempo disponível eu tento ajudar alguém por aqui, mas se quiser uma ajuda mais próxima me contacte:
                                    Site: https://www.ontradingx.com.br
                                    Youtube: https://www.youtube.com/@ontradingx
                                    Boa sorte a todos nós!

                                    English - I'm from Brazil and I've been using the Fxdreema system for a few years, whenever I have time available I try to help someone here, but if you want more help, contact me:
                                    Website: https://www.ontradingx.com.br
                                    Youtube: https://www.youtube.com/@ontradingx
                                    Good luck to all of us!

                                    1 Reply Last reply Reply Quote 0
                                    • Q
                                      QuantEngineer last edited by

                                      About the Backtester, aka Strategy Tester, it doesn't display the events because MQL5 inhibits the usage of the Functions and Methods used by the CALENDAR EVENTS group. On MQL official documentation, they say that they do it to speed up the tester.

                                      One possible workaround would be to create a database or CSV File, run the algorithm in live data ahead of the test to fill in the database, then during the test, read the events from the database rather than reading from the source of the events. But because this seems very troublesome to have to run the algo live prior to the test, I didn't implement this solution... If anyone else has any other suggestions on how to overcome this limitation, please feel free to share and use the existing code to implement the solution on top of it.

                                      Quant Engineer
                                      www.abfs.tech

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        Dre last edited by

                                        Hi all,

                                        Thanks for sharing the great work @QuantEngineer

                                        Should this work as a simple test?

                                        News Filter Test.png

                                        It's not working for me currently as trades are still taken 2 minutes before and after economic calendar events.

                                        Any advice?

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          Dre last edited by

                                          Has anybody been able to get this to work?

                                          1 Reply Last reply Reply Quote 0
                                          • M
                                            morteza alishahi @QuantEngineer last edited by

                                            @QuantEngineer said in Finally, News Filter for MT5 in 1 easy to use Block !!:

                                            System

                                            D 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 2 / 4
                                            • First post
                                              Last post

                                            Online Users

                                            N
                                            L
                                            A
                                            E
                                            B

                                            14
                                            Online

                                            146.6k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors