General MT4/MT5 SETTINGS/INPUT Guide

31 January 2024, 06:14
Biswarup Banerjee
0
415

GENERAL SETTINGS

Lot Size

The lot size/volume for the first trade. Before starting any martingale, hedge, grid or compounding. If the EA does not have any feature which can increase the lot size, all trades will be placed with this same lot size

Stoploss in pips

 Initial Stoploss for a trade in pips. If passed 0 then no stoploss will be set. Stoploss can be modified by other features inside EA like trailing stoploss, breakeven, martingale, hedge, averaging.

Take Profit in pips

 Initial Take profit for a trade in pips. If passed 0 then no take profit will be set. Take profit can be modified by other features inside EA like breakeven, martingale, hedge, averaging.

Trade Comment

This input decides the comment for each trade. Comment is by default hidden. It is helpful when you have multiple EAs running and you want to distinguish trade sources (EAs)

Capture Logs

 Throughout the application we have logged information which helps in troubleshooting any issue. In case if you face any issue with trade placement or other turn it on to see the logs inside expert tab.

Conditions check mode

Checking all the order/position modification or closure every tick makes a EA very slow in backtesting . Thats why introduced this dropdown. Where you can select EA checks on every tick or overy candle of your currently applied timeframe.

Enable Magic Number

This input will control the behavior of the EA, whether it should check the conditions for different activities like Trailing Stop, Breakeven, Grid, etc. to be check on certain magic number, if false then it would only check the symbol where the Ea is applied

Magic Number

It is a unique identifier of an Expert advisor. When enable magic number is true, it checks all the conditions for the trades which is applied to current chart of he ea and has magic number mentioned in the input

Trade On New Bar

This input controls the trade placement time. If set to true, then EA does not constantly check for the entry condition to place a trade. It only checks the condition on beginning of the currently selected timeframe candle. Let’s say ea is applied to a 5 min chart. Then Ea check entry at 9:00, then 9:05, then 9:10 ….

No New Entry If Trade Exists

There could be 2 scenarios upon confirming an entry. The user can take the entry, even if there is an active trade from the previous signal or he simple don’t want to take multiple signal entries. Rather he just enters when there is no active position. This input controls this behavior.

Number Of Orders

Upon getting an entry signal how many trades should be executed is controlled by this input
Trade Direction

This input controls whether ea should place only buy signal trades, sell signal trades or both

Risk Reward Ratio

This input set the take profit based on the stoploss value. Let’s say you have specified the stoploss value as 10 pips then and mention risk reward ratio as 2, then it would automatically set the take profit value as 20 pips

Next open trade after x second

When you get multiple entry signals on close intervals then, this input helps us save so many unnecessary close interval trades. It specifies the minimum time gap between two open trades

Check for opposite Close

 For buy and sell trades we have different entry conditions. But most of the time their entry conditions are inverse. For example, we take buy when 5 period SMA crosses above 20 period SMA, on the other hand we take sell when 5 period SMA crosses below 20 period SMA. But when we enter, we should close the previous trend trade because it is not valid anymore would make losses

So, exit of buy = entry of sell

Exit of sell = Entry of Buy

If we check this option then, the previous trend signal trade will be closed first then the current trend signal trade will be placed

Delete Pending Order at Distance

If the pending order is X pips away from the order open price they would be deleted automatically

Delete pending order after x seconds

If the pending is not triggered within X seconds, then it will be deleted automatically

Delete Pending Order After N bars

If the pending is not triggered within N candles from where it was placed, it will be deleted automatically.

Profit Amount

When set, it will close a trade when the profit is reached the mentioned amount in this input. If take profit is also set then whichever happens first will close the trade

Loss Amount

When set, it will close a trade when the loss is reached the mentioned amount in this input. If stoploss is also set then whichever happens first will close the trade

Profit Percent

When set, it will close a trade when the profit is reached the mentioned percent profit of the account equity. If take profit is also set then whichever happens first will close the trade

Loss Amount

 When set, it will close a trade when the loss is reached the mentioned percent loss of the account equity. If stoploss is also set then whichever happens first will close the trade

Close After N Candle

It will close a trade after n candle from it’s opening candle irrespective of the exit criteria or stoploss or take profit.

 

BREAKEVEN SETTINGS

Enable Breakeven:

This is a Boolean (true/false) input parameter that determines whether the breakeven functionality should be enabled (true) or disabled (false).

Breakeven Activation:

This is a numeric input parameter representing the distance in pips from the entry price at which the breakeven functionality will be activated. If the price moves in favor by this amount, breakeven is triggered.

Breakeven extra pips:

This is a numeric input parameter representing the additional number of pips beyond the breakeven activation level at which the stop-loss will be set. It helps provide a buffer to cover trading costs and potential slippage.

 

TRAILING STOP SETTINGS

Use Trailing Stop:

This is a Boolean (true/false) input parameter that determines whether the trailing stop functionality should be enabled (true) or disabled (false).

Activate:

This is a numeric input parameter representing the distance in pips from the entry price at which the trailing stop functionality will be activated. Once the market moves in favor by this amount, the trailing stop is triggered.

Trail price by:

This is a numeric input parameter representing the distance in pips that the trailing stop follows behind the current market price. As the price moves in favor, the trailing stop will maintain a distance of TRAILING_DISTANCE pips.

Increment by:

This is a numeric input parameter representing the increment by which the trailing stop distance is increased. If the market continues to move in favor, the trailing stop distance will be increased by this amount.

 

ACCOUNT TRAILING STOP SETTINGS

Activate:

Boolean input parameter that determines whether the account-level trailing-stop functionality should be enabled (true) or disabled (false).

ACCOUNT_TRAILING_START:

Numeric input parameter representing the amount (not pips) by which the account equity needs to increase for the account-level trailing-stop functionality to be activated.

Trail price by:

Numeric input parameter representing the amount (not pips) that the account-level trailing stop follows behind the current account equity. As the equity increases, the trailing stop will maintain a distance of ACCOUNT_TRAILING_DISTANCE amount.

Increment by:

Numeric input parameter representing the increment by which the account-level trailing stop distance is increased in terms of amount. If the account equity continues to increase, the trailing stop distance will be increased by this amount.

 

MARTINGALE SETTINGS

Martingale is a kind of loss recovery strategy which is either used solely or combined with other loss recovery strategies like GRID, HEDGE If this strategy is enabled then when one trade makes a loss when it closes. Like it hit the stoploss or closed by the ea due to loss amount hit, it opens the next trades with Martingale multiplier. It repeats the process till it get a profitable trade and then reset

e.g. 0.01(loss) 0.02(loss) 0.04(loss) 0.08(profit) 0.01 …

Enable/Disable Martingale:

Boolean input parameter that determines whether the Martingale functionality should be enabled (true) or disabled (false). If set to true, the EA will use the Martingale strategy; otherwise, it won't.

Multiplier:

Numeric input parameter representing the multiplier applied to the trade size in each Martingale step. If the Martingale strategy is enabled, this multiplier determines the size of subsequent trades relative to the initial trade size.

Multiply After N repeat:

Integer input parameter representing the number of repeats before applying the Martingale multiplier to the trade size. If set to 3, for example, the multiplier will be applied after every 3 consecutive losing trades.

Max Step:

Integer input parameter representing the maximum number of Martingale steps that can be taken. It limits the number of consecutive losing trades where the trade size is increased according to the multiplier.

Adjust take profit:

Boolean input parameter that determines whether to adjust the take profit level based on Martingale steps (true) or not (false). If set to true, the take profit level may be adjusted as part of the Martingale strategy.

 

GRID SETTINGS

Grid trading is another loss recovery strategy where buy and sell orders are placed at set intervals above and below the current market price, forming a grid. This approach capitalizes on price fluctuations within a predefined range. Traders aim to profit as the market moves, adding or closing positions strategically. Key elements include fixed order distances, consistent or rule-based lot sizes, and criteria for initiating, managing, and closing positions. Grid trading is effective in ranging markets, leveraging price oscillations for potential gains. Risk management is crucial, and ongoing market monitoring is advised.

Enable/Disable Grid:

Boolean input parameter that determines whether the GRID functionality should be enabled (true) or disabled (false). If set to true, the EA will use the GRID strategy; otherwise, it won't.

Step Distance:

Integer input parameter representing the distance in pips between each grid level. It defines how far apart each grid level should be.

Lot increase mode:

Enumeration input parameter that determines how the lot size should be increased for each new grid level. It can be set to either GRID_MULTIPLY (multiply) or GRID_INCREMENT (increment).

Execution Mode:

Numeration input parameter that specifies the execution mode for placing grid orders. It can be set to either GRID_MARKET (market orders) or GRID_PENDING (pending orders). If market orders are selected then when the grid distance is reached it will place a market order there. But some delay/high volatility can cause a slight difference in distance. In pending order mode when a grid level is activated its next grid level’s pending order is placed immediately. For buy orders a buy limit order will be placed at grid distance, for sell a sell limit order.
When all orders are closed then pending grid orders are deleted automatically

Increase Factor:

Numeric input parameter representing the factor by which the lot size is increased for each new grid level. For example, if someone select increase mode increment then it places 0.03,0.05,.07… lot size if initial lot size is 0.01 and increase factor is 2. If multiply is selected the lot would be 0.02,0.04,0. 08...

Distance Multiplier:

Numeric input parameter representing the multiplier applied to the grid distance for each new grid level.

Increase After N repeat:

Integer input parameter representing the number of repeats before applying the grid increase factor. If set to 1, for example, the factor will be applied after every 1 grid level.

Max Grid Step:

Integer input parameter representing the maximum number of grid steps that can be taken. Post that it will close all orders and start from the initial lot size

Grid Activation Mode:

Enumeration input parameter that determines when the grid should be activated. It can be set to either GRID_ON_LOSS (on loss) or GRID_ON_PROFIT (on profit).

SL and TP mode:

Enumeration input parameter that specifies the mode for setting stop-loss and take-profit. It can be set to FIXED AMOUNT, EQUITY PERCENT, or COST_AVERAGE.

Grid Fixed Stoploss:

When the SL AND TP MODE   is selected to FIXED AMOUNT then when combined loss of all trades reaches the amount mentioned in the input, EA will close all the orders

Grid Fixed Takeprofit:

When the SL AND TP MODE   is selected to FIXED AMOUNT then when combined profit of all trades reaches the amount mentioned in the input, EA will close all the orders

Grid Equity Pct Stoploss:

When the SL AND TP MODE   is selected to EQUITY PERCENT then when combined loss of all trades reaches the amount equivalent to x% mentioned in the input, EA will close all the orders

Grid Equity Pct Takeprofit:

When the SL AND TP MODE   is selected to EQUITY PERCENT then when combined profit of all trades reaches the amount equivalent to x% mentioned in the input, EA will close all the orders

AVERAGE_MODE:

Enumeration input parameter that determines the mode for averaging orders. It can be set to Sum (Price x Lot)/Sum(Lots) or Sum(Price)/ Sum(Orders).

AVG STOPLOSS:

When the SL AND TP MODE is selected to COST_AVERAGE then the average price of all trades is calculated based on the above input average mode, and stoploss is set to X (mentioned in the input) pips from the average price.

AVG TAKEPROFIT:

When the SL AND TP MODE is selected to COST_AVERAGE then the average price of all trades is calculated based on the above input average mode, and take profit is set to X (mentioned in the input) pips from the average price.

 

HEDGE SETTINGS

Hedging is a risk management strategy that involves opening positions to offset potential losses in existing trades. In Forex trading, it commonly involves opening a buy and sell position simultaneously on the same currency pair. Hedging aims to protect against adverse market movements, providing a degree of insurance for traders. The strategy is versatile, offering a way to manage risk in volatile markets or uncertain conditions. However, it requires careful execution and understanding of the associated costs, as hedging involves additional transaction expenses. Generally, we open higher lot size trades at the hedge distance to come out profitable if the trend is reversed opposed to our prediction

Enable/Disable Hedge:

Boolean input parameter that determines whether the HEDGE functionality should be enabled (true) or disabled (false). If set to true, the EA will use the Hedge strategy; otherwise, it won't.

Hedge Distance:

Integer input parameter representing the distance in pips between two hedge level. It defines how far apart each hedge level should be.

Lot Increase Mode:

Enumeration input parameter that determines how the lot size should be increased for each new hedge level. It can be set to either MULTIPLY (multiply) or INCREMENT (increment).

Increase Factor:

Numeric input parameter representing the factor by which the lot size is increased for each new hedge level. For example, if someone select increase mode increment then it places 0.03,0.05,.07… lot size if initial lot size is 0.01 and increase factor is 2. If multiply is selected the lot would be 0.02,0.04,0. 08...

Max Step:

Integer input parameter representing the maximum number of hedge steps that can be taken.

Execution Mode:

Enumeration input parameter that specifies the execution mode for placing hedge orders. It can be set to either MARKET (market orders) or PENDING (pending orders).

Hedge SL and TP mode:

Enumeration input parameter that specifies the mode for setting stop-loss and take-profit for hedge orders. It can be set to either FIXED_AMOUNT or EQUITY_PCT.

Hedge Fixed Stoploss Amount:

When the HEDGE SL AND TP MODE   is selected to FIXED_AMOUNT then when combined loss of all trades reaches the amount mentioned in the input, EA will close all the orders

Hedge Fixed Takeprofit Amount:

When the HEDGE SL AND TP MODE   is selected to FIXED_AMOUNT then when combined profit of all trades reaches the amount mentioned in the input, EA will close all the orders

Hedge Equity Pct Stoploss:

When the HEDGE SL AND TP MODE   is selected to EQUITY_PCT then when combined loss of all trades reaches the amount equivalent to x% mentioned in the input, EA will close all the orders

Hedge Equity Pct Takeprofit:

When the HEDGE SL AND TP MODE   is selected to EQUITY_PCT then when combined profit of all trades reaches the amount equivalent to x% mentioned in the input, EA will close all the orders

 

RISK SETTINGS

 

Enable Risk to Lot:

Boolean input parameter that determines whether the Risk to Lot functionality should be enabled (true) or disabled (false). If set to true, the EA will use risk management based on lot size; otherwise, it won't.

Risk Percent:

Numeric input parameter representing the risk percentage per trade. It defines the percentage of the account balance that is at risk for each trade.

Risk pips Per MicroLot / Stoploss:

Numeric input parameter representing the risk in pips per micro lot or stop-loss. It defines the number of pips at risk for each micro lot traded. Ideally this should be equal to the STOPLOSS pips mentioned in the input. But sometime user can put stoploss amount instead of STOPLOSS pips for virtual stoploss. For that reason, we have a separate input for risk calculation. If user want to calculate risk based on stoploss input, then mention same value in this input and STOPLOSS input

 

 

POSITION SIZING SETTINGS

 

Enable Position Sizing:

Boolean input parameter that determines whether the Position Sizing functionality should be enabled (true) or disabled (false). If set to true, the EA will adjust the position size based on the specified criteria; otherwise, it won't.

Increase Lot:

Numeric input parameter representing the increase in lot size for each trade when Position Sizing is enabled. It defines the additional lot size applied to each subsequent trade.

Increase Lot On Account Balance:

Numeric input parameter representing the account balance value at which the lot size should be increased. When the account balance reaches or exceeds this value, the lot size is adjusted according to the specified increase.

 

ALERT SETTINGS

Allow Alert:

Boolean input parameter that determines whether the EA is allowed to trigger alerts. If set to true, the EA can generate alerts on new entry; otherwise, it won't.

Allow Notification:

Boolean input parameter that determines whether the EA is allowed to send notifications on new entry (such as push notifications on mobile devices). If set to true, the EA can send notifications; otherwise, it won't.

Allow Email:

Boolean input parameter that determines whether the EA is allowed to send email notifications on new entry. If set to true, the EA can send emails; otherwise, it won't.

 

TRADE TIME SETTINGS

allows users to customize trading activity based on specified time periods. Traders can define distinct sessions such as Asian, European, American, and an additional session if needed. Each session has designated start and end times in broker time. The option to enable or disable trading during specific sessions provides flexibility, and users can choose to have continuous 24/7 trading if preferred. This feature enhances strategy customization by aligning the EA's trading activities with specific market sessions or adhering to a continuous trading approach, catering to diverse trading preferences. If more than one session is enabled then if the current time is between those time, it will allow the trading.

 

Use Trading Times:

Boolean input parameter that determines whether the EA should adhere to specified trading times. If set to false, the EA will trade 24/7; otherwise, it will follow the specified session times.

Enable Asian Session:

Boolean input parameter that enables or disables trading during the Asian session.

Start Time Asian and End Time Asian:

String input parameters representing the start and end times of the Asian session in broker time.

Enable Europian Session:

Boolean input parameter that enables or disables trading during the European session.

Start Time Europian and End Time Europian:

String input parameters representing the start and end times of the European session in broker time.

Enable American Session:

Boolean input parameter that enables or disables trading during the American session.

Start Time American and End Time American:

String input parameters representing the start and end times of the American session in broker time.

Enable Other Session:

Boolean input parameter that enables or disables trading during another specified session.

Start Time and End Time:

String input parameters representing the start and end times of the specified session in broker time.

Close All if trading time not valid

This input decides whether to keep the trades out of trading time window or close them. If set to true , when the current time crosses the end time of the session filter it will close all the trades.

 

TRADING DAY SETTINGS

The "Trade Days Settings" feature in this MetaTrader 4 (MT4) Expert Advisor (EA) enables users to customize trading days. Traders can selectively enable or disable trading on each day of the week, offering flexibility to align the EA's activity with preferred trading days or market conditions.

 

 Monday Trade, Tuesday Trade, Wednesday Trade, Thursday Trade, Friday Trade:

Boolean input parameters that determine whether trading is allowed on each respective day of the week (Monday through Friday). If set to true, the EA will trade on that day; otherwise, it won't.

Saturday Trade and Sunday Trade:

Boolean input parameters that determine whether trading is allowed on Saturday and Sunday, respectively. If set to true, the EA will trade on that day; otherwise, it won't.

Close All if trading day not valid

This input decides whether to keep the trades out of trading day window or close them. If set to true , when the current day is not a trading day. Lets say you mark Friday as a no trade day. When Friday comes it will close all open positions


SAFEGUARD SETTINGS

The "Safeguard Settings" in this MetaTrader 4 (MT4) Expert Advisor (EA) provide comprehensive risk management controls. Traders can set parameters for slippage, limit the number of open and pending orders, control maximum drawdown, and establish daily, weekly, and monthly trading targets. These safeguards enhance the EA's risk management capabilities, allowing for a tailored approach to protect capital and align with specific trading objectives.

Slippage:

Integer input parameter representing the maximum allowed slippage in pips for trade execution.

Maximum Open Trades:

Integer input parameter representing the maximum number of open trades allowed. If set to 0, this safeguard is disabled.

Maximum Long Trades and Maximum Short Trades:

Integer input parameters representing the maximum number of long and short trades allowed, respectively. If set to 0, the corresponding safeguard is disabled.

Maximum Pending Orders:

Integer input parameter representing the maximum number of pending orders (buy/sell stops and limits) allowed. If set to 0, this safeguard is disabled.

Maximum Long Pending Orders and Maximum Short Pending Orders:

Integer input parameters representing the maximum number of long and short pending orders allowed, respectively. If set to 0, the corresponding safeguard is disabled.

Max Drawdown percent:

Double input parameter representing the maximum acceptable drawdown as a percentage of the account balance. If set to 0, this safeguard is disabled. Post that it will close all orders.

Max Drawdown amount:

Double input parameter representing the maximum acceptable drawdown as an absolute amount. If set to 0, this safeguard is disabled. Post that it will close all orders

Maximum Trades Per Day:

Integer input parameter representing the maximum number of trades allowed per day. If set to 0, this safeguard is disabled.

Maximum Loosing Per Trade:

Integer input parameter representing the maximum number of losing trades allowed per day. If set to 0, this safeguard is disabled.

Daily Stop:

Double input parameter representing the maximum acceptable drawdown for a single trading day. If the cumulative drawdown exceeds this value, the EA close all the positions and halt trading for the day.

Daily Target:

Double input parameter representing the target profit to achieve within a single trading day. Once this target is reached, the EA close all the positions and stop trading for the day.

Weekly Stop:

Double input parameter representing the maximum acceptable drawdown for a trading week. If the cumulative drawdown exceeds this value, the EA close all the positions and cease trading for the week.

Weekly Target:

Double input parameter representing the target profit to achieve within a trading week. Once this target is reached, the EA close all the positions and stop trading for the week.

Monthly Stop:

Double input parameter representing the maximum acceptable drawdown for a trading month. If the cumulative drawdown exceeds this value, the EA close all the positions and cease trading for the month.

Monthly Target:

Double input parameter representing the target profit to achieve within a trading month. Once this target is reached, the EA close all the positions and stop trading for the month.

 

 

DISPLAY SETTINGS

 

Panel Width Pct:

Double input parameter representing the width of the panel as a percentage of the dashboard window. It defines how much horizontal space the panel occupies on the chart with respect to the total available width.

Panel Hight Pct:

Double input parameter representing the height of the panel as a percentage of the dashboard window. It defines how much vertical space the panel occupies on the chart with respect to the total available height.

Text Size Pct:

Double input parameter representing the size of text within the panel as a percentage. It determines the scaling factor for the text size, affecting the readability and presentation of information. Larger the value larger will be the fonts

Title Color:

Color input parameter defining the color of the title text within the panel. It sets the visual appearance of the title, making it easily distinguishable from other elements.

Label Color:

Color input parameter defining the color of labels or descriptive text within the panel. It sets the visual appearance of labels, helping to differentiate them from other components.

Value Color:

Color input parameter defining the color of numerical values or data within the panel. It sets the visual appearance of the data, providing clarity and emphasis on numeric information.

These are the features which is present mostly in my epert advisor. This guideline will help the end user understand the EA better. 

Check all my products: https://www.mql5.com/en/users/biswait50/seller

Contact me for support: https://www.mql5.com/en/users/biswait50

 


Share it with friends: