Yalnızca ürünü satın alan veya kiralayan kullanıcılar yorum yazabilir
Dennis Muchiri Miano  

How to connect Precision News Filter to your Expert Advisor

This utility works by setting a flag that your EA reads before opening any trade. Connecting it takes two small additions to your EA's code and about 5 minutes.

Step 1 — Copy the include file

Download the companion file NewsFilter.mqh from the attachment in this comment. Place it in the following folder inside your MT5 data directory:

MQL5 / Include / NewsFilter / NewsFilter.mqh

To find your MT5 data directory: in MT5 go to File → Open Data Folder.

Step 2 — Add one line at the top of your EA

Open your EA file in MetaEditor and add this line at the very top, with your other include statements:

#include <NewsFilter/NewsFilter.mqh>

Step 3 — Add one line inside OnTick()

Find the OnTick() function in your EA. Add this as the very first line inside it, before any other logic:

if(NewsTradingBlocked(_Symbol)) return;

That is all. Your EA will now automatically skip new entry signals whenever a news event is within the protection window. When the window clears, it resumes on its own.

Step 4 — Verify it is working

Attach Precision News Filter to any chart. Press F3 in MT5 to open Global Variables. You should see entries like NewsBlock_EURUSD, NewsBlock_XAUUSD and so on. When a value shows 1.0 your EA is being blocked for that symbol. When it shows 0.0 trading is clear.


Important notes

The utility must be running on your MT5 instance for the block to work. If it is not attached to a chart, your EA will trade normally with no news protection. For VPS users, attach the utility to a quiet chart such as XAUUSD M15 and leave it running permanently.

The utility never touches your EA's logic. It only signals. If you remove the two lines above, your EA returns to its original behaviour with no other changes needed.


If you need help post a comment below with your EA name and which step you are on and I will assist.


Dosyalar:
Dennis Muchiri Miano  
EA INTEGRATION GUIDE — Read this before asking questions
Download the companion file NewsFilter.mqh attached below. Place it in: MQL5/Include/NewsFilter/NewsFilter.mqh
Step 1 — Add at the top of your EA:
#include <NewsFilter/NewsFilter.mqh>
Step 2 — Add as the first line of OnTick():
if(NewsTradingBlocked(_Symbol)) return;
Compile your EA (F7). Attach the utility to any chart. Done. Your EA now pauses automatically before news and resumes when the window clears.
Verify: Press F3 in MT5. You should see NewsBlock_EURUSD, NewsBlock_XAUUSD etc. 1.0 = blocked. 0.0 = clear.
12:03
Updated Newsfilter.mqh file
Dosyalar:
NewFilter.mqh  4 kb