NewsFilterForEA
- 程序库
- M YUSUF EFFENDY
- 版本: 1.2
- 激活: 5
Library for an Expert Advisor. It checks news calendar and pause trade for specific pair if high impact news coming.
News Filter for an Exert Advisor. Easily apply to your EA, just needs simple scripts to call it from your EA.
Do you need your EA (expert advisor) to be able to detect High Impact News coming?
Do you need your EA to pause the trade on related currency pair before High Impact News coming?
This News Filter library is the solution for you.
This library requires indicator NewsCal-v107.ex4 (by Tim Morris 2012) in folder MQL4/Indicators and must be attached on chart.
Just put the simple script in your EA to call this News Filter library, and your EA will be able to detect High Impact News coming and pause the trade for related currency pair.
The function returns:
- FALSE if specific pair was blocked to trade
- TRUE if specific pair was allowed to trade
Importing the function from the library
// ============= COPY TO CALLER EA =================== // ----- Following SCRIPT must be put into CALLER EA as GLOBAL VARIABLE (without any change) // ----- Needs file NewsCal-v107.ex4 (thanks to Tim Morris) in folder MQL4/Indicators enum news_filter { hr0=0,//NO News Filter Applied hr1=1,//PAUSED 1 Hour Before High Impact News hr2=2,//PAUSED 2 Hours Before High Impact News hr3=3,//PAUSED 3 Hours Before High Impact News hr4=4,//PAUSED 4 Hours Before High Impact News hr5=5,//PAUSED 5 Hours Before High Impact News hr6=6,//PAUSED 6 Hours Before High Impact News hr7=7,//PAUSED 7 Hours Before High Impact News hr8=8,//PAUSED 8 Hours Before High Impact News hr9=9,//PAUSED 9 Hours Before High Impact News }; extern news_filter HourToStart= 1;//SET EA to be PAUSED before High Impact NEWS (for Related Pairs), Default is -1Hr #import "NewsFilterForEA.ex4" // This file must exist in folder MQL4/Libraries void NewsFilter(char HourToStart); bool NewsState(char HourToStart); string NewsCCY(char HourToStart); bool GetAllowCcy(string PairSymbol, char HourToStart); #import //=======================================================
Example of use in Expert Advisors
void OnTick() { if(GetAllowCcy(PairSymbol,HourToStart)) //-- if return is TRUE, execute Order ticket=OrderSend(Symbol(),OP_BUY,Lot,Ask,Slippage,SL,TP,"Comment",MagicNbr,0,Blue); else return; //-- if return is FALSE, skip Order } //-- OnTick()
You can set how many hours prior to incoming High Impact News to pause the trade,
for example:
You set News Filter to detect 3 hours prior to incoming High Impact News,
for example the news (Durable Goods Order) will be coming at 19:30 (your PC time),
start from 16:30 until 19:45 (your PC time), News Filter will be activated to pause the trade on USD,
so any pair with USD (EURUSD, USDCHF, etc.) will not be traded (blocked), but the pair without USD (EURJPY, AUDNZD, etc.) still can be traded.
Check following screen shoot for better understanding.
Important
If you bought/rented this product, after installing/download from MT4 terminal, it goes to folder MQL4/Scripts/Market.
You need to move it into folder MQL4/Libraries, and call it from your EA using above scripts.
If you need assistance, you can send email to yusufeffendy74@gmail.com