Advanced Momentum EA

30 March 2024, 12:35
Jan Flodin
0
117

The main purpose of this blog is to describe and explain the input parameters of my Momentum Expert Advisor for MT5The recommended usage of this EA is to trade currencies on larger movements as a result of central bank events (typically interest rate decisions). It can be used though on other medium and high impact news as well.

This is an out-of-the-box product which will normally not be modified based on request from a single customer. Please therefore first read this blog to the end and/or download a demo and test the EA in the strategy tester in order to understand what it can and cannot do.

Whenever there is an available update of the EA I recommend you to wait with updating until all open positions by the EA have been closed. You can update it without removing the previous version from the chart. After updating please control that the input parameters have not changed on each chart where the EA is loaded.

Backtest with news data and correct GMT offset

If you will not use the Auto settings then I strongly recommend you to do your own backtesting and fine tuning in the strategy tester before starting to trade on a live account. For backtesting H1 time frame should be used. It is enough using '1 minute OHLC' modelling since the EA will handle events only on opening of a new M1 candle. This is valid also for setting trailing stop and break even. I recommend setting an execution delay of 150 ms to simulate slippage.

The news source used is the Metatrader Calendar. Please make sure that your VPS has the correct time, else it might lead to MT5 showing the wrong GMT time. Just check with the MT5 calendar if the next news event that is showing on the chart has the correct GMT time.

Follow these steps to do a backtest with news filter from historic news events. 

  • Make sure you know the GMT offset of the historic chart data you got in your MT5 terminal. If you are not sure, best look at the latests big news, which caused a breakout on the chart and check the time with the MT5 calendar in GMT format.
  • When installing the EA the first time the news file 'newshistory.bin' will be created in the folder Metratrader common folder. It depends on your user name and is usually located in  C:\Users\YOUR_USER_NAME\AppData\Roaming\MetaQuotes\Terminal\Common\Files\news\. In some cased the file can be empty (size is 0 bytes). In that case please delete the file change the value in an input parameter in the EA. That should do the trick.
  • Run the backtest in Visual mode and check on the chart whether the next events are printed in the upper left corner of the chart.
Please remember that past performance is not a guarantee of future profitability and that the optimized backtest results cannot provide a realistic prediction of future profitability.

Input parameters

  • GENERAL SETTINGS
    • EA mode - List box with the following selections:
      • Trade normally
      • Pause EA - Will pause the EA. No new oders or modifying of existing orders (trailing stop etc.).
    • Multi symbol mode in tester - If set to True then the all symbols given in the 'Symbols to trade' input parameter will be tested.
    • Start date for news in tester (file) - Will create the news file for  back testing starting with news from this date. If you know that you will back test from 2020.01.01 then to get better performance you should delete the file and set this date instead of the default 2015.01.01.
    • Symbols to trade - Each symbol must be separated with a comma (,). For trading only the Margin curreny (the first currency) the symbol name must be followed by by -1. For instance USDCHF-1, which means that only USD events will be traded. For trading only the Profit curreny (the second currency) the symbol name must be followed by by -2. For instance USDJPY-2.
    • Use auto settings - 
  • GENERAL TRADING FILTERS
    • Open buy order True or False.
    • Open sell order True or False.
    • Allow pending orders for reversal signals - If set to True (default) then a pending order (buy or sell stop) will be placed in the opposite direction and close to the stop loss.
    • Allow more than 1 pending order in same direction - It can be possible with several stop orders in case an order quickly hits break even and a new order is opened in the same direction due to a consistent signal.
    • Maximum allowed spread in points (0 = disabled) - Can be set to avoid taking trades with to high spread after a news releases. The default settings is 50, which is suitable for a low spread broker.
      • Maximum allowed slippage in points (0=disabled) - Please note that not all brokers/account types support slippage control.
    • TIME FILTERS
      • NY close broker (GMT+2 winter, +3 summer, US DST) - True or False. If set to True then the 2 following inputs don't have to be set.
      • GMT manual winter offset - In case you want to set the GMT offset manually yourself. Keep in mind that on most brokers the GMT offset will change twice a year because of daylight saving time. 
      • Broker Daylight Saving Time (DST)List box with the following selections:
        • None
        • US
        • Europe
      • Weekdays to trade [1-Mon..7-Sun] - If you for instance would like the EA to trade every weekday except Friday the the value must be set to 1234.
      • Friday stop trade time (-1=disabled)
      • Friday close time (-1=disabled) - To avoid keeping open positions over the weekend.
    • NEWS SETTINGS
      • Event type - List box with the following selections:
        • Bank events
        • Other events
        • Both
      • Bank events (impact=high, sector=money) - List of bank events. Must be comma separated. Can be put with lower or upper characters.
      • Other events (impact=high,medium)
      • Checking start minute [0-8] - 
      • Checking end minute [4-30] - 
      • Trigger scale factor [0.24-0.48] - 
      • Trigger scale factor for additional order (0=disabled)
      • Minutes to wait for addtional order [15-240]
        • RISK MANAGEMENT - I cannot set the risk for you, please consider yourself what risk you are willing to take, specially considering your account leverage.
          • Lot calculating method - List box with the following selections:
            • Fixed lot
            • Equity step
            • Risk %
          • Fixed lot size or lot increment step - Fixed lot or how much the lot size should be increased every Lot increment equity step (if Lot calculating method  = Equity step).
          • Lot increment equity step 0.01 lots per 400 EUR balance is seems to be a fair value according to backtest. The backtest from 2015.01.01 resulted in a 7% balance drawdown and a15% equity drawdown with this setting.
          • Risk in percentage - Used if Lot calculating method  = Risk %. If set to 1% then with 6 concurrent orders you risk 6% of your account balance.
          • Max. open positions (0=disabled) -  Set to for instance 6 and you will never risk that the EA will have more than 6 active trades. Important to understand is that you are using Risk % and have set it to for instance 1% then with 6 trades your potentially risking 6% in case all of the positions should hit stop loss.
          • Stop trading when Equity decreased (0=disabled) - will not open any new orders if the equity is decreased by this number. If you put for instance 1000 and your current balance is 4000 then the EA will not open new trades if your equity goes below 3000.
          • Stop trading when Free margin below (0=disabled) -  will not open any new orders if the free margin goes below this number.
          • Max allowed balance drawdown % (100=disabled)
          • Orders with this Magic number (0=all) - With the default value (67) the EA will only check open order where the Magic number starts with 67. So if you have other EAs running with open orders then they will not be taken into consideration.
          • Close orders - If set to True then all orders, where the magic number starts with the value you have set above, will be closed immediately when the max value has been reached.
        • POSITION MANAGEMENT
          • Stop loss scale factor [0.2-0.45]
          • Trailing stop scale factor [0.25-0.9]
          • Trailing step (<0 = minutes, >0 = points)
          • Break even trigger scale factor [0.06-0.24] (0=BE disabled)
          • Multiplier for Trigger/SL/TS/BE [0.66-1.34] - This parameter is for a quick way of diversification. It will scale the stop loss, break even, trailing stop and entry trigger parameters by the multiplier specified. For example, instead of running one set with 0.03 lots, you could run 3 sets with 0.01 lots and scale factors 0.8, 1.0 and 1.2. This way your entries and exits will be slightly different on each set.  
              • OBJECTS
                • Info panel auto colors
                • Info panel background color
                • Info panel border color
                • Info panel caption color
                • Info panel text color
                • Info panel attention color
                • Info panel font size
              • EA SETTINGS
                • Magic number - Should be different if you for some reason have the EA running on several chart with overlapping symbols.
                • Order comment


              Files:
              newshistory.zip  1085 kb
              Share it with friends: