- It is highly recommended to use a VPS and low-spread 5-digit broker who closes daily candles at 5 pm New York time.
Such a broker gives five 24-hour daily candles every week.
The default EA settings are for EURUSD M30. Presets for customizing (GMT offset: +2, DST: US/Europe) can be downloaded from the Download page. <Preset file structure> <How to Use the EA>
Structure of Magic Number:
For example: 
Direction: ‘1’ – buy, ‘2’ – sell;
MagicNumber: a basic identifier of the EA’s orders, for example, ‘70111’;
OrderID: [’00’…’99’max] used to split a large order into multiple orders, see the MaxLot_Per_Order parameter. If MaxLot_Per_Order set to ‘0’ then OrderID=’00’.
Complete list of settings (v1.83 November 15, 2018):
- LotSize – a fixed lot of orders. Used if UseMargin% and Balance are set to 0.
- Balance – amount for each increment of LotSize. In case of non-zero value, the EA calculates the lot size based on the account balance, e.g., 0.05 lots for every $1000. This management type increases (decreases) the lot size when the account balance increases (decreases). The lesser the amount, the higher the risk. If ‘Balance’ set to a negative value then the EA calculates lot sizes based on the account equity.
- UseMargin% – % of free margin which is used when entering a trade. If UseMargin%=0, the EA will use LotSize.
- MaxRiskPerTrade% – maximum risk (as a percentage of the account balance) per trade based on StopLoss value. If MaxRiskPerTrade%=0, the EA will use LotSize or UseMargin%.
- MaxLot_Overall – maximum lot size that the EA can use.
- MaxLot_Per_Order, StepBetweenOrdersPip – using these parameters, the EA can execute a large order and optimize execution. If a trader uses a large trading lot size of 100lots or more, the EA can split the large parent order into several child orders, ‘MaxLot_Per_Order‘ is a maximum size lot for each order. It allows to improve execution and performance and eliminate impact on the market. Pending orders can be placed with a small step (‘StepBetweenOrdersPip’ = 0.1…0.5pips) or at the same price (‘StepBetweenOrdersPip’=0). Placement with a small step reduces impact, slippage and diversifies execution. An example: https://www.mql5.com/en/signals/375720
- MaxLot_OpenOrders_Filter – if the total amount of open lots in the MT4 terminal is more or equal to this parameter, then all new trades/signals will be ignored. If the value is negative, then the filter works only with the current pair.
- MaxNumber_OpenOrders_Filter – if the overall number of open orders in the MT4 terminal is more or equal to this parameter, then all new trades/signals will be ignored. If the value is negative, then the filter works only with the current pair.
- Disable_TP&SL_Control – set to ‘true‘ if you want to be able to change manually the TP/SL levels of open positions/orders of the EA. Be careful because the EA will not control the correctness of SL/TP levels.
Time *Time limits will be disabled if the value is set to -1.
- OrderHourStart/Stop – hour to start/stop looking for a trading signal (MT4 server time).
- OrderMinuteStart/Stop – minute to start/stop looking for a trading signal.
- OrderDayOfWeek – day/days of the week the EA can open a trade.
- OrderMonth – month, when the EA is allowed to trade. The ‘OrderMonth‘ parameter allows you to determine which months are more profitable. This parameter is used only for testing.
- OrderMonths – months, when the EA is allowed to trade. Values from 1 January to 12 December separated by comma character, for example: 1,2,3,4,5,6,7,8,9,10,11,12.
- OrderHours – hours, when the EA is allowed to trade. Values from 0 to 23 separated by comma character.
- OrderMinutes – minutes, when the EA is allowed to trade. Values from 0 to 59 separated by comma character.
- Model type – model (PCh, Pivot, PA) which will generate a trading signal.
- Execution type – limit, stop or market orders. Market execution can be used as M or MR.
- PendingOrderModify – if set to true, the EA will try to modify an existing pending order if the entry price is changed or incorrect. If false, the EA will try to open a new order with the correct price. The outdated pending order will be deleted.
- MaxSpreadPip – when the spread goes up beyond this value the EA will not open a market order.
- MaxSpreadToExitPip – the EA will not close a position if the spread exceeds this value.
- MaxSlippagePip – allow you to specify the maximum slippage for a market order (opening/closing a position). It works only with Instant Execution (for example, accounts of standard, classic, micro and nano type). This parameter does not matter on an ECN account (Market Execution). MaxSlippagePip – is a maximum deviation from the quoted price. Thus, if Instant Execution is used, the EA can control slippage using the maximum pips deviation from the ask/bid price. If a broker is unable to fill an order within specified deviation, the trade is rejected, and a requote message is returned.
- SkipFirstTrade – use this parameter to skip the first trade of the day. I recommend to use it only for testing.
- OneTradePerDay – use this parameter to limit the EA to trade only once a day.
- OneDirectionSimultaneously – if set to true, the EA will not open Buy and Sell orders simultaneously.
- TradeDirection – long, short or both can be selected.
- DailyATR_Period – a period of DailyATR. Used for the normalization of the volatility.
- NYCloseBroker – set this parameter to false if your broker server time is not set to New York close. If you use an NY close broker (who closes daily candles at 5 pm New York time, it corresponds to GMT+2 in winter and GMT+3 in summer), keep this parameter by default (=true) and in this case, no need to set GMT_offset and Daylight_Saving_Time.
- GMT_offset – GMT offset of your broker in the winter period. This parameter is used if NYCloseBroker is set to ‘false’.
- Daylight_Saving_Time – set this parameter to US/Europe if your broker changes the GMT offset in the summer period. This parameter is used if NYCloseBroker is set to ‘false’.
The Model is based on the horizontal support [Low] and resistance [High] levels. The EA determines the support/resistance levels based on a confirmed minimal/maximum prices. The EA can adjust offset of high/low levels for optimization purposes. The PCh model can be used as a breakout (EURUSD, GOLD) or a mean-reversion strategy (night-time AUDNZD, AUDCAD, EURNZD). The optimal take-profit/stop-loss levels for the MR/M strategies are the middle of the range (HL/2 level).
- PCh_TimeFrame – timeframe of the Price Channel.
- PCh_Period – defined period of the Price Channel.
- PCh_Left(Right)_Confirm – minimal number of bars to confirm extrema on the left (right) side.
- PCh_OffsetPip, HL/2_OffsetPip – offset of the Price Channel levels for best execution.
- PCh_Algorithm – the method used in Price Channel calculations. The Price Channel levels are lines which are set above and below the price. In case of value:
– Last_High/Low – method is based on the maximum and minimum values of the price for a certain period. In this case, the calculation takes into account only the last highest/lowest values of the price, and on their basis, the EA constructs two lines forming the price range.
– Bollinger Bands – method is based on two standard deviations away from a simple moving average.
– Confirmed_Level – method is based on the confirmed maximum/minimum prices for a certain period.
– Pullback_Mode – method is based on a pullback from the Price Channel levels.
– Inclined_Lines – in this mode, the EA constructs two inclined lines (support and resistance levels), forming a price range. These lines are based on the two last confirmed extrema.
- LevelExpirationBars – this parameter determines a maximum lifetime of an inclined line from the moment of its construction.
- UseBrokenLevels – if set to false and a fake break occurs, the EA will not use the broken level again. This parameter can be used with the methods ‘Confirmed_Level‘ and ‘Inclined_Lines‘.
The Model uses pivot points to determine critical support and resistance levels. The EA calculates central line (CL) at a specified time (Initial Hour) using the following formula: CL = (Highest Price (Period)) + Lowest Price (Period) + Close Price at a Specific Time) / 3. Support levels (SL) and resistance levels (RL) are then calculated off this central line: SL = CL – a Percentage of the Daily ATR; RL = CL + a Percentage of the Daily ATR. The Pivot model can be traded as BR/MR strategy.
- Pivot_InitialHour – initial hour to calculate the central line (CL).
- Pivot_CentralLine – a method used for calculations of the central line. In case of value:
– (H+L+C)/3 – CL = (Highest Price (Period)) + Lowest Price (Period) + Close Price at a Specific Time).
– Simple Close – CL = Close Price at a Specific Time;
- Pivot_LevelSize – a percentage of the DailyATR to calculate support and resistance levels.
The Model is based on the analysis of the price movement at a specified time/place. The Model identifies simple M/MR chart patterns. The PA model can be used to build a seasonal trading system. The PA model can be traded as M/MR strategy.
- PA_TimeFrame – timeframe of the Price Action model.
- PA_InitialHour, PA_Bars – an initial hour and number of bars to analyze the price movement.
- PA_Size%ATR – minimal size (in %ATR) of the price movement.
- ReversalLevel% – % of the price movement to calculate the level of limit order placement (0 = off).
- StopLoss, TakeProfit – max. permissible loss and profit target. It can be expressed in pips (in case of value > 3) or %ATR (in case of 0 < value <3). If a value set to 0, then the EA places SL(TP) in the middle of the price range (HL/2 level).
- Take|Stop Modify – if true, the EA will modify take-profit (stop-loss) if the calculated support and resistance levels are changed.
- MaxTakeProfit(StopLoss)Pip – use this parameter to limit (in pips) the maximum value of ‘TakeProfit’ (‘StopLoss’). For example, the ‘MaxTakeProfitPip’ can be useful if a value of ‘TakeProfit’ is set in the middle of a price channel.
- CloseOnOppositeSignal – if true, the EA will close a trade if an opposite signal is generated.
- TradingPauseBar – trading pause (in bars) initiated after closing a trade. The EA does not open a new trade during the Trading Pause period. In case of value < 0, the EA uses Trading Pause if a trade is closed at a loss.
- StopBar – time-based stop that automatically closes trades after a certain number of bars, regardless of other conditions (0 = off).
- StopHour – time-based stop that automatically closes trades at a specified hour, regardless of other conditions (>23 = off).
- FridayStopHour – hour to close trades on Friday’s (-1 = off).
- DisableTP(SL)_Hour – hour to temporarily disable MT4 TP (SL) for 1 hour, i.e., the MT4 TP (SL) value will be set to 0 within one hour. Set it to -1 if you want to disable this feature. This parameter can protect your position during a low-liquidity time and spread widening.
- TakeToBreakevenPip – minimum loss level in pips when the TP should be moved to breakeven, i.e., to the open price of the position (0 = off).
- TrailingStopPip – in case of value > 0: trailing in pips when a position is in profit, in case of value < 0: minimum profit level in pips when the SL should be moved to breakeven (0 = off).
- TrailingActivationPip – determines the amount of pips (in profit) to activate ‘TrailingStopPip‘.
- StopProfitBar, StopProfitPip – if a position has a floating profit more than ‘StopProfitPip‘ pips, and the position holding time has exceeded ‘StopProfitBar‘ bars, then such a trade will be automatically closed, regardless of other conditions.
- DontUseMT4_SL – use this parameter with low-liquidity pairs/symbols/tickers/markets. The setting disables MT4 stop-loss (the EA sets MT4 SL to 0). The SL is executed as a market order by the EA.
*Set value to 0 to disable a filter.
- EMA_TimeFrame – timeframe of the EMA filter.
- EMA_Period, DailyHL/2_Period – a period of the trend filter. The trend filter passes buy/sell signals when price closes above/below EMA (DailyHL/2 level), and the other way around if the value of the filter is negative. I do not recommend using EMA and DailyHL/2 simultaneously.
- VolaFilter%ATR_Intraday(Daily) – value in % of DailyATR. The Intraday filter passes signals if the width of a price range > specified value and the other way around if a value of the filter is negative. The Daily filter passes signals if the ratio of DailyATR/DailyATR(30-day) > specified value, and vice versa if a value of the filter is negative.
- PivotFilter – set it to use the Pivot Model as a filter.
- RangeFilter – filter is based on the current price location inside a local price range.
- ShadowFilter – a minimal ratio(%) of the upper/lower shadows to the DailyATR.
- PreviousDay’s_Return%ATR – value in % of DailyATR.
In case of value > 0:
– a buy (for MR) / sell (for M) signal is passed if the previous day’s return (Close-Open) < -specified value * DailyATR/100;
– a sell (for MR) / buy (for M) signal is passed if the previous day’s return > specified value * DailyATR/100;
In case of value < 0:
– a sell (for MR) / buy (for M) signal is passed if the previous day’s return < -specified value * DailyATR/100;
– a buy (for MR) / sell (for M) signal is passed if the previous day’s return > specified value * DailyATR/100.
- HurstFilter – set to use the Hurst Exponent as a filter. The values of the Hurst exponent vary between 0 and 1. The price is likely to have: Persistence – value 0.5 – 1 (i.e., whatever is happening now is likely to continue); Anti-persistence – value 0 – 0.5 (i.e., whatever is happening now is likely to reverse); Randomness – value around 0.5 (i.e., likely to go in any direction). The filter passes buy and sell signals when Hurst Exponent > a specific value and the other way around if the specific value of the filter is negative.
- HurstTimeFrame – timeframe of the filter.
- HurstFilterBars – number of bars in a time series.
- RSI_Filter% – filter is based on the ‘RSI’ indicator. The RSI_Filter% can work in two modes:
- Tail mode (in case of value > 0). In this mode:
– a Mean-reversion strategy filters out (ignores) a buy/sell signal when the ‘RSI’ is below 50–RSI_Filter% / above 50+RSI_Filter%, respectively;
– a Momentum strategy filters out a sell/buy signal when the ‘RSI’ is below 50–RSI_Filter% / above 50+RSI_Filter%.
This mode allows you to filter out too dangerous situations on the market. For example, an MR strategy can ignore any buy signals if the price drops too sharply because there is a high chance that the price will continue to fall. A BR strategy can ignore a buy signal if the price approaches the upper level with too high acceleration.
- Peak mode (in case of value < 0). In this mode:
– a Mean-reversion strategy filters out (ignores) a buy/sell signal when the ‘RSI’ is above 50-|RSI_Filter%| / below 50+|RSI_Filter%|;
– a Momentum strategy filters out a sell/buy signal when the ‘RSI’ is above 50-|RSI_Filter%| / below 50+|RSI_Filter%|.
This mode allows you to ignore signals with too low potential.
- Tail mode (in case of value > 0). In this mode:
- RSI_TimeFrame, RSI_FilterPeriod – RSI indicator corresponding parameter settings.
- UserComment – a field custom comment that can be used to label the orders opened by the EA.
- MagicNumber – a basic identifier of the EA’s orders. This number should be less than 99999 and unique when multiple EAs are attached to a terminal.
- Graphics – this option allows to enable/disable graphical objects on a chart.
- VinceCalculator – calculates an Optimal F by Ralph Vince. Ralph Vince developed Optimal F MM as an AGGRESSIVE way to grow the account balance. Optimal F position sizing method uses the fixed fraction to bet (for example, risk per trade) that maximizes the geometric rate of equity growth. The ‘OPTF‘ is an optimal level of risk expressed as a maximum percent loss per trade so that the average percent growth after each trade (‘GMEAN‘) assumes its maximum value. This parameter works only in Strategy Tester. Many thanks to AntFx for the Vince source code.
How to use VinceCalculator and Optimal F Money Management
1. Set ‘VinceCalculator’ to ‘true‘ and run a backtest with a fixed lot (don’t use Balance, UseMargin%, MaxRiskPerTrade%);
2. After the backtest is completed press ‘F3‘ to see the results;
3. The ‘OPTF’ value always lies between 0 and 1 (0%…100%). For example, for a value of 0.41, you need to set MaxRiskPerTrade%=41.