Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Indicators

FFC - Forex Factory Calendar - indicator for MetaTrader 4

traderathome
Published by:
awran5
Views:
159967
Rating:
(119)
Published:
2016.08.26 16:52
Updated:
2016.11.22 07:32
FFC.mq4 (34.66 KB) view

This is a modified version of the popular news indicator FFCal which was published initially by DerkWehler to ForexFactory forum. Actually, I've modified the code to suit my needs but I found that it may be useful for others as well so I decided to share it. I have rewritten the indicator so you can consider it almost "build from scratch" of the original. Yet, it shares the same techniques and main style.

The indicator places a panel on your chart that shows 5 economic events listed on the Forex Factory Calendar. You can filter out/in the events of High, Medium, or Low impact, Speaks, Holidays or by specific keyword filter. Please see all modifications listed below.

Also, the indicator can be called within an EA using the iCustom() function by accessing 2 buffers:

  • Buffer (0) contains minutes until the most recent event.
  • Buffer (1) contains impact value for the most recent event (Low = 1, Medium = 2, High = 3).

You can call buffers in two ways:

Simple call: (default values will be applied)

int EventMinute = (int)iCustom(NULL,0,"FFC",0,0);
if(EventMinute == 30) { .. YOUR CODE .. } // 30 minutes before the event

int EventImpact = (int)iCustom(NULL,0,"FFC",1,0);
if(EventImpact == 3)  { .. YOUR CODE .. } // High impact event

Advanced call:

iCustom(
        string       NULL,            // symbol 
        int          0,               // timeframe 
        string       "FFC",           // path/name of the custom indicator compiled program 
        bool         true,            // true/false: Active chart only 
        bool         true,            // true/false: Include High impact
        bool         true,            // true/false: Include Medium impact
        bool         true,            // true/false: Include Low impact
        bool         true,            // true/false: Include Speaks
        bool         false,           // true/false: Include Holidays
        string       "",              // Find keyword (case-sensitive)
        string       "",              // Ignore keyword (case-sensitive)
        bool         true,            // true/false: Allow Updates
        int          4,               // Update every (in hours)
        int          0,               // Buffers: (0) Minutes, (1) Impact
        int          0                // shift 
        );

*Please note that the indicator does not have (at this stage) back-testing capabilities.


Suggested style:

  • High Impact color = C'217,83,79'
  • Med Impact color = C'255,185,83'
  • Low Impact color = C'91,192,222'
  • Holidays color = clrOrchid
  • Remarks color = clrDimGray

Calendar legend:

  • m/m: Month Over Month
  • q/q: Quarter Over Quarter
  • y/y: Year Over Year
  • K Thousand
  • M Million
  • B Billion
  • T Trillion

FFC 1

FFC 2

FFC 3

Modifications:

  1. Added: #property strict for compatibility with MetaTrader 4 Build 600+ and better code quality.
  2. Added: Show event Previous/Forecast impact (colored impact).
  3. Added: Option to show events related to active chart only (override other parameters)
  4. Added: Keyword filter. Find or Ignore a specific one word, i.e. "NFP", will filter out all events with/without only that word. (case-sensitive)
  5. Added: Option to show currency strength / bar time left / spread value.
  6. Added: Option to control the time for display of past events (in minutes).
  7. Added: Option to set panel location in 4 chart corners.
  8. Added: Tool-tip on mouse hover that shows event title, impact and event time left.
  9. Added: Panel title. You can use it as a reminder note :)
  10. Modified: Show event in "Date/Time format" instead of minutes left (you can show minutes left through Tool-tip)
  11. Modified: Vertical lines for the upcoming events. (You may need to modify the "time offset" input depending on your broker time).
  12. Modified: Buffers that holds the upcoming event minute and impact (see examples above)
  13. Modified: Revised order of External Inputs.
  14. Improved: Replaced DownLoadWebPageToFile() function with native Windows URLDownloadToFileW() function.
  15. Improved: Placed (download/read XML file) and related codes into a functions so we can call them when needed.
  16. Improved: Replaced "GlobalVariables" that used to update XML file with FILE_MODIFY_DATE - OnTimer() set by "AllowUpdates", "UpdateHour" inputs.
  17. Improved: Time GMT offset, now the events will show in your local time automatically.
  18. Improved: Justify the panel/text when set to right/left.
  19. Improved: Alert function, Now it will send beside the Popup Alert: sound alert, Push notification on your phone and Emails. (two separate alerts)
  20. Improved: Code quality, now the indicator is lighter and faster than ever.
  21. Fixed: Various bug fixes, some unnecessary/unused codes or variables removed, placed some variables inside their related functions.

Real Authors:

Credit:


* In order to use this indicator, you need to turn on DLL Imports in your MetaTrader 4 platform options.
* Please be aware that the code may have some bugs or other flaws, so if you see any bugs or suggestions, or even better code practice, please let me know.
* According to Forex Factory website, all event times are approximate and subject to change.

TickRecorder TickRecorder

Continuously records tick data in format "DateTime, Bid, Ask, Volume" even after restart.

Lot Rebate Calculator Lot Rebate Calculator

This script is used to calculate lot rebate.

LinesProfitLoss LinesProfitLoss

Calculates profit (loss) of the current orders on the symbol.

PricePosition PricePosition

PricePosition indicator provides the position of price in the point of angle when the price rises above (BUY) or falls below the angle section line (SELL).