Home System Trading Post

News EA Template for MetaTrader 4: No DLL Required

Attachments
16308.zip (2.94 KB, Download 0 times)

If you’re looking to incorporate news trading into your strategy without the hassle of using a DLL, you’re in the right place! This is a straightforward source code template for an Expert Advisor (EA) that pulls in news from investing.com, all done in MQL4.

This template is perfect for anyone wanting to enhance their trading toolkit, especially if you plan to list your product on the Market where DLL usage is a no-go. With this setup, you can easily implement news-based trading functionality yourself. It’s based on the Urdala News Investing indicator, which is a great starting point.

With this EA, you have a variety of options at your fingertips. For instance, you can configure it to halt trading during major news releases, close profitable positions ahead of the news, or even set up pending orders prior to the announcements. The possibilities are endless! Think of this template as a draft—let your creativity take the reins!

Even though it’s just a template, it’s fully functional as a news background indicator. It generates signals and draws lines on your chart to keep you informed.

News lines

Here’s What You Need to Know:

The core of the code includes a segment like this:

if(CheckNews>0)
     {
      // Actions during news release
      Comment("News time");

        }else{
      // Actions when there’s no news
      Comment("No news");

     }

This EA currently provides a simple comment about whether there’s news or not. Feel free to customize it by inserting your own conditions for news events!

Important: To ensure the EA functions correctly, make sure to add the following link to your trusted URL list:

http://ec.forexprostools.com/?columns=exc_currency,exc_importance&importance=1,2,3&calType=week&timeZone=15&lang=1

Variable Breakdown:

  • BeforeNewsStop - The number of minutes to pause trading before news hits, e.g., 5 minutes. The EA switches to "News time" mode.
  • AfterNewsStop - The number of minutes to pause trading after the news, e.g., 5 minutes. The EA exits "News time" mode.
  • NewsLight, NewsMedium, NewsHard - Options to download weak, medium, or strong news.
  • offset - Your time zone (GMT).
  • NewsSymb - Currencies for which news should be downloaded. If left empty, it uses the currencies of the current symbol.
  • DrawLines - This option allows you to draw lines on the chart.
  • Next - Set to only draw upcoming news, not past events.
  • Signal - Alerts you about impending news based on the BeforeNewsStop setting.

If you run into any trouble customizing the EA, don’t hesitate to reach out for help!

Related Posts

Comments (0)