작업 종료됨
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
명시
A mt4 AND mt5 EA which Enables/Disables Auto-Trading by News Data stored in a CSV File
Task:
Create an EA similar to the very famous IceFXNews to disable trading before news events and enable trading after news events
Both MQL4 and MQL5 versions are required.
The indicator/EA reads events from a csv file. The csv file has a strict format / data structure as attached example.
The CSV file is saved under C:\Users\username\AppData\Roaming\MetaQuotes\xxxx, so I would not need to update this csv file in each mt4/mt5 directory separately.
Parameters and functions:
Parameter | Type | Note |
Calender data name | text | xxxx.csv. Format is identical as attached example csv file. |
Enable news filter | True/false | General switch of news filter |
GMT-Offset broker server | int | GMT-Offset broker server to csv file. For example broker server is in GMT3, csv file time and date is for GMT0, then this value should be 3-0=3 |
Trading currencies in this terminal | Text array | I will manually type in the traded currencies in this array like “USD,CAD,EUR,…” so that the EA will only take care of USD,CAD and EUR relevant news events. Only consider forex currencies. For example, a SGD related news will not stop auto-trading in terminal, which trades only EURUSD and AUDUSD. If this array is empty, then controll all currencies by news events This setting controls all parameters/functions below! |
Text to identify speech | Text arry | “peech,speak,speaks” means events containing any of these 3 strings is a speech-type-event. Case insensitive! |
enable low impact news | True/false | General switch of actions by low impact news |
Include (enable) low impact speech | True/false | Treat speech as news |
* (star) Close all relative positions before low impact news/speech | True/false | Pay attention: this switch has 2 threshold values below! |
Close positions FL/FP threshold | Number | Calculate the to-be-closed-positions’ floating loose/floating profit. For example “-0.8” means only if ALL to-be-closed positions’ FL<=0.8 account currency unit, then close all relative positions. “15” means only if SUM FP>=15, close all relative positions. “0” means ignore this setting, close all relative positions if the * (star) parameter is “true”. |
Close positions lot size threhold | number | For example, 0.5 means close relative positions lot size >= 0.5, “0” means close all relative positions if the * (star) parameter is “true”. |
Close position action time before low impact news/speech | number | 5 means close positions 5 minutes before news schedule. |
Close positions if low impact news is bad for pending positions | True/false | The EA should record the FL/FP of news relative positions before disable auto-trading. After auto-trading is enabled after news event, the EA compare FL/FP with the value before disable auto-trading. If FL/FP after news is worse (more floating loose, less floating profit) than before news, then close all news relative positions. |
Disable auto-trading by low impact news/speech | True/false |
|
Disable auto-trading action time before low impact news/speech | number | 70 means disable auto-trading 70 minutes before news schedule. |
Enable trading minutes after low impact news | number | In minute. |
Enable trading minutes after low impact speech | number | In minute. Since speech takes more time than news. The time will be different as above. |
Repeat above points for mid impact news/speech | ||
Repeat above points for high impact news/speech |
EA should pop-up warning if close position is later than disable auto-trading (wrong setting, wrong logic).
Panel
EA should have an very easy panel to show following information:
1. Next relevant event: time, subject and related currency, action.
Example:
Position of the Text is chart right down corner.
Next event: 2021.09.15, Nonfarm Payroll Data release, USD, close currency related positions if FL<=0.8 30 minutes before event, disable auto-trading 25 minutes before event, enable auto-trading 30 minutes after event.
Thank you!