The default settings of the EA correspond to the ‘Daily_levels‘ set-file. 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 single order into multiple orders, see the MaxLot_Per_Order parameter. If MaxLot_Per_Order set to ‘0’ then OrderID=’00’.
Correct GMT settings for testing my set-files:
The complete list of settings (v1.86 April 04, 2019):
- LotSize – fixed lot size for trading if UseMargin% and Balance are set to 0.
- Balance – proportional lot size calculated by the formula: LotSize * AccountBalance/Balance. It works together with LotSize. This MM proportionally increases (decreases) lot sizes when the account balance increases (decreases), respectively. The smaller the value, the higher the risk. In case of non-zero value, the EA calculates lot sizes based on the account balance, e.g., 0.05 lots for every $1000. If ‘Balance‘ set to a negative value, then the EA calculates lot sizes based on the account equity.
- UseMargin% – % of free margin to open a trade. If UseMargin%=0, the EA will use LotSize/Balance parameters.
- MaxRiskPerTrade% – maximum risk (as a percentage of the account balance) per trade based on the StopLoss value. If MaxRiskPerTrade%=0, the EA will use LotSize or UseMargin%.
- MaxLot_Overall – maximum lot size that the EA can use for trading.
- MaxLot_Per_Order, StepBetweenOrdersPip – these parameters help execute a large order and optimize execution. The EA can split a large parent order into several child orders, ‘MaxLot_Per_Order‘ is the maximum lot size for each child order. It allows to improve execution 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 the market impact, slippage and diversifies execution.
- MaxLot_OpenOrders_Filter – if the total lot size of open trades in your MT4 account is more or equal to this parameter, then all new trades/signals will be ignored. If the value is negative, then the filter takes into account only the current pair.
- MaxNumber_OpenOrders_Filter – if the overall number of open orders in your MT4 account is more or equal to this parameter, then all new trades/signals will be ignored. If the value is negative, then the filter takes into account only the current pair.
- Disable_TP&SL_Control – set it to ‘true‘ if you want to be able to manually change 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.
- MaxSpreadPip – if the spread exceeds this value, then the EA will not allow opening a new trade. It works only with a market order, pending orders will not be closed.
- MaxSpreadToExitPip – if the spread is above this value, then the EA will not allow closing an open position.
- MaxSlippagePip – parameter allows you to specify the maximum slippage (as a max. deviation from the quoted price) for a market order. It works only with Instant Execution (for example, standard, classic, micro, and nano accounts). This parameter has no effect on an ECN account. If MaxSlippagePip >0, the EA will control slippage using the maximum deviation from the ask/bid price. If a broker is unable to fill an order within a specified deviation, then the order will be rejected.
- OrderHourStart/Stop – hour when the EA should start/stop looking for trading signals.
- OrderMinuteStart/Stop – minute when the EA should start/stop looking for trading signals.
- OrderDayOfWeek – day(s) of the week when the EA is allowed to open a new trade.
- OrderMonth – the month when the EA is allowed to open a new trade. The ‘OrderMonth‘ parameter can be used to determine the most profitable months.
- OrderMonths – months when the EA is allowed to open a new trade. Values from 1 (January) to 12 (December) separated by a comma, for example: 1,2,3,4,5,6,7,8,9,10,11,12.
- OrderHours – hours when the EA is allowed to open a new trade. Values from 0 to 23 separated by a comma.
- OrderMinutes – minutes when the EA is allowed to open a new trade. Values from 0 to 59 separated by a comma.
- DaysOffBeforeAfterNY – a trading pause which is activated before/after the New Year for a specified number of days. For example, if DaysOffBeforeAfterNY=3, then the EA will not open new trades from December 29 to January 3.
- UseNewsFilter – enable/disable the News filter. To use the News filter in live trading, you must allow requests to:
https://www.worldtimeserver.com (backup URL)
Tools -> Options -> Expert Advisors -> Allow WebRequests for listed URL.
To use it on backtest, you must download News events database and extract ‘BelkaEventsData’ folder to ‘\Common\Files‘ folder (File -> Open Data Folder -> Up to ‘Terminal’ -> Common -> Files).
- DataProvider – select a provider whose data you want to use.
- Symbols – symbols used to download news events, separated by a comma (for example. EUR,USD,GBP). If this parameter is empty, the EA will use the current symbols. If Symbols set to ALL, then all possible symbols will be used.
- FilterEvents – allows you to select news events based on the impact level: HIGH, MOD, LOW, SPEECH. If set to ‘Custom’, then the EA will use FilterCustomEvents parameter.
- FilterCustomEvents – news events or keywords separated by a comma, the letter case (lower, higher) does not matter. For example: FOMC,rate,job,HIGH,MOD. If it is empty, the EA will use all news events. For example, if FilterCustomEvents=rate, the EA will use news events whose titles contain ‘rate‘.
- FilteringAction – action to be performed: Ignore new & close exist. trades, Ignore new signals, Close existing trades, No action.
- BeforeEventMin – how long to wait before a news event (in minutes).
- AfterEventMin – how long to wait after a news event (in minutes).
- DisplayEvents – show news events on a chart.
- Model type – the model (PCh, Pivot, PA) which will generate trading signals.
- Execution type – limit, stop or market orders.
- UsePercentagePips – if true, then the EA parameters expressed in pips will be calculated as a percentage of the current price. 1 pips = 0.01% of the price. It may help determine more stable values of TP/SL and other parameters for highly volatile assets like XAUUSD (GOLD).
- PendingOrderModify – if set to true, the EA will modify an existing pending order if the entry price has changed or has become incorrect. If false, the EA will open a new order with the correct price. Incorrect pending order will be deleted.
- SkipFirstTrade – skip the first trade of the day.
- OneTradePerDay – allow trading only once a day.
- OneDirectionSimultaneously – if set to true, the EA will not open Buy and Sell positions (both directions) at the same time. For example, if there is an open sell position, then any new buy signal will be ignored.
- TradeDirection – long, short or both directions.
- DailyATR_Period – the DailyATR period. It is used for normalization of the volatility.
- NYCloseBroker – set this parameter to false if your broker’s server time is not set to New York Сlose. If you use a NY close broker (who closes daily candles at 5 pm New York time, that corresponds to GMT+2 in winter and GMT+3 in summer), then no need to change the default settings.
- GMT_offset – GMT offset of your broker in winter. This parameter should be configured only if NYCloseBroker=false.
- Daylight_Saving_Time – set this parameter to US/Europe if your broker changes the GMT offset in the summer period. This parameter should be configured only if NYCloseBroker=false.
The model uses horizontal support [Low] and resistance [High] levels based on the minimal/maximum prices (extrema) confirmed during a certain period of time. The PCh model can be used as a breakout or mean-reversion strategy. It is possible to set/adjust the offset of the High/Low levels for optimization purposes. The optimal TP/SL levels for the MR/M are in the middle of the price range (HL/2 level).
- PCh_TimeFrame – timeframe of the Price Channel.
- PCh_Period – a period of the Price Channel.
- PCh_Left(Right)_Confirm – the minimum number of bars to confirm extremum on the left (right) side.
- PCh_OffsetPip, HL/2_OffsetPip – offset of the Price Channel levels.
- PCh_Algorithm – methods used for calculating the Price Channel:
– Last_High/Low is based on the latest maximum and minimum prices for a certain period. On their basis, the EA constructs two horizontal lines forming the price range.
– Bollinger Bands is based on two standard deviations away from a simple moving average.
– Confirmed_Level is based on the confirmed maximum/minimum prices for a certain period.
– Pullback_Mode is based on a pullback from the horizontal Price Channel levels.
– Inclined_Lines is based on two inclined lines (support and resistance levels) drawn through the last confirmed extrema.
- LevelExpirationBars – the maximum lifetime of an inclined line from the moment of its construction, in bars.
- UseBrokenLevels – if a false breakout occurs and the price retreats back, then the EA will not reuse the broken levels. 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 model can be used for building a breakout or mean-reversion strategy.
- Pivot_InitialHour – the initial hour to calculate the central line (CL).
- Pivot_CentralLine – methods used for calculating the center line:
– (H+L+C)/3 is based on the following formula: CL = (Highest Price (Period)) + Lowest Price (Period) + Close Price at a Specific Time).
– Simple Close is based on the following formula: CL = Close Price at a Specific Time.
- Pivot_LevelSize – the percentage of DailyATR for calculating support and resistance levels.
The model is based on the analysis of price movements over a certain period of time. The PA identifies simple M/MR patterns and can be used to build a seasonal trading strategy.
- PA_TimeFrame – timeframe of the Price Action model.
- PA_InitialHour, PA_Bars – the initial hour and number of bars to analyze price movement.
- PA_Size%ATR – minimal size (in %ATR) of price movement.
- ReversalLevel% – % of price movement to calculate the pending order placement level (0 = off).
- ReversalExpirationBars – how long to hold a pending order, in bars.
- StopLoss, TakeProfit – stop loss and take profit. They can be expressed in pips (in case of value > 3) or %ATR (in case of 0 < value <3). If value = 0, the EA places SL(TP) in the middle of the price range (HL/2 level).
- Take|Stop Modify – in case of true, the EA will modify take profit (stop loss) if the support and resistance levels have changed.
- MaxTakeProfit(StopLoss)Pip – parameter to limit the maximum value (in pips) of TakeProfit (StopLoss).
- CloseOnOppositeSignal – if true, the EA will close a trade if an opposite signal is generated.
- TradingPauseBar – trading pause (in bars) initiated after the closing a trade. The EA does not open a new trade during the pause. In case of value < 0, the EA will use it only if the previous trade is closed at a loss.
- StopBar – time-based stop loss that automatically closes trades after a certain number of bars, regardless of other conditions (0 = off).
- StopHour – time-based stop loss that automatically closes trades at a specified hour, regardless of other conditions (>23 = off).
- FridayStopHour – hour to close trades on Friday (-1 = off).
- DisableTP(SL)_Hour – hour to temporarily disable MT4 TP (SL) for an hour during a low-liquidity time. A value of -1 is disabled this feature. The MT4 SL can be activated due to the spread widening (for example, due to an increase from 3 to 40 pips), and this may lead to a big loss. The MT4 SL cannot correctly protect an open position during a low-liquidity time. Disabling MT4 TP is useful on backtests to get more accurate results.
- TakeToBreakevenPip – minimum loss level in pips at which TP should be moved to breakeven (0 = off).
- TrailingStopPip – in case of value > 0: trailing stop in pips when a position is in profit, in case of value < 0: minimum profit level in pips when SL should be moved to breakeven (0 = off).
- TrailingActivationPip – determines the number of pips 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 to disable MT4 SL. The SL will be executed as a market order by the EA. This parameter cannot work together with TrailingStopPip.
- EMA_TimeFrame – timeframe of the EMA trend filter.
- EMA_Period, DailyHL/2_Period – a period of the trend filter. The trend filter passes buy/sell signals if the price is above/below EMA (DailyHL/2 level), respectively, and the other way around if the filter value is negative. No point to use EMA and DailyHL/2 simultaneously.
- VolaFilter%ATR_Intraday(Daily) – value in % of DailyATR. The Intraday filter passes signals if the width of the price range > specified value and the other way around if the 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 the value of the filter is negative.
- PivotFilter – allows using the Pivot Model as a filter.
- RangeFilter – filter based on the location of the current price inside a local price range.
- ShadowFilter – 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 – allows using 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 > specific value and the other way around if the filter value is negative.
- HurstTimeFrame – timeframe of the filter.
- HurstFilterBars – the number of bars in a time series.
- RSI_Filter% – filter based on the ‘RSI’ indicator. 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%, respectively.
This mode allows you to filter out too dangerous situations on the market. For example, a MR strategy may 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 may 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%|, respectively;
– a Momentum strategy filters out a sell/buy signal when the ‘RSI’ is above 50-|RSI_Filter%| / below 50+|RSI_Filter%|, respectively.
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 settings.
- UserComment – user comment used to label orders opened by the EA.
- MagicNumber – a unique basic identifier of EA’s orders. This number should be less than 99999.
- UseSettingsFile – extra settings managed via belkaglazer.ini config file. Read more>>>
- Graphics – this option allows you to enable/disable graphic objects of the EA on a chart.
- FixMajorBugs – parameter used for backward compatibility with earlier versions of the EA. Allows you to disable/enable major bug fixes. There were fixed 2 major bugs that may slightly affect the performance of some old set-files. These bugs do not affect EA stability! Therefore, you can continue to use them as part of a strategy.
1. PCh_Left_Confirm parameter bug – this parameter worked incorrectly in the ‘Last_High/Low‘ PCh mode with pending orders. Because of this bug, the EA may delete pending orders for a while.
2. Bollinger Bands mode bug – this mode worked incorrectly with Market execution. Because of this bug, the EA may use the ‘Last_High/Low‘ mode to generate a trading signal.
- 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.
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.
Dangerous MM options
These MM settings can lead to a significant drawdown in a short time!
My signals, strategies, and set-files do not use dangerous MM.
- Dangerous_MM – allows you to add various dangerous methods of Money Management to any strategy. These methods use the latest trading results to determine the volume (lot size) of a new trade/position. They are also known as ‘Trading the equity curve’. This option uses the orderID section of MagicNumber, so it can’t work together with MaxLot_Per_Order, StepBetweenOrdersPip. Also, MaxLot_OpenOrders_Filter and MaxNumber_OpenOrders_Filter can be applied only to the initial order (P,A).
– Disable – dangerous MM is not used (by default). To enable it in LIVE trading it is necessary to set UseSettingsFile=enable and change the ‘DangerousMM‘ line in the belkaglazer.ini file. Read more>>>
– Anti-Martingale (AM) is based on increasing position sizes after a closed profitable trade to maximize trading results on winning streaks.
– Martingale (M) is a try to exit from a drawdown sooner by increasing position sizes after a closed loss.
– Pyramiding (P) is based on increasing position sizes of an open profitable trade (by using floating profits).
– Averaging (A) is a try to close an unsuccessful open trade at a profit by increasing position sizes and improving the average entry price.
- MaxNumberOfSteps – maximum number of levels (for AM,M)/positions (for P,A).
- Multiplier – lot size multiplier, 0.001…∞.
- CustomMultiplier&Steps – allows you to set custom values for MaxNumberOfSteps, Multiplier, MinStepValuePip (optional).
For example, 2-25,4-50,8-35 or 2,4,8. If this parameter is empty, then the EA uses MaxNumberOfSteps, Multiplier, (MinStepValuePip).
- MinStepValuePip – minimum step value, in pips.
- ComputeDrawdown – how to calculate a drawdown: inPips or inMoney. This parameter works together with AM,M. In case of ‘inMoney‘, the ‘MinStepValuePip‘ parameter is not used.
- TP(SL)_Calculation_Method – methods for calculating TP(SL) levels of orders for P,A:
– Initial price. The SL(TP) levels are calculated based on prices of the initial order according to the strategy rules.
– Separate price. The EA calculates the SL(TP) levels separately for each position/order according to the strategy rules. This is the only method that allows using a trailing stop.
– Avg. price. The SL(TP) levels are calculated based on the average entry price according to the strategy rules.
– Weighted price. Same as Avg. price, but SL(TP) is weighted by the volume (lot size). This method allows you to keep the initial SL/TP values in money unchanged after adding new positions.
Examples of Dangerous MM methods: Examples_of_Dangerous_MM_Methods.zip