0% found this document useful (0 votes)
227 views16 pages

Expert Advisor Parameters Guide

Uploaded by

farhood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
227 views16 pages

Expert Advisor Parameters Guide

Uploaded by

farhood
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Expert Advisor Parameters Guide 1

Expert Advisor Parameters Guide


Dynamic Programming Solutions Corporation
www.MetaTraderProgrammer.com

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 2

Contents
How To Use This Manual.................................................................................................................3
Order Parameters...............................................................................................................................4
Indicator Parameters........................................................................................................................6
Trade Signal Management.............................................................................................................7
Trailingstop Parameters (Stoploss)...........................................................................................8
Trailingstop Parameters (Takeprofit).......................................................................................9
Trading Time Filters.........................................................................................................................10
Order Limits.........................................................................................................................................11
Money Management........................................................................................................................12
Stealth....................................................................................................................................................13
Miscellaneous Parameters...........................................................................................................13
How an EA Identifies the Bars on the Chart. ..................................................................14
Setting bar=0................................................................................................................................14
Frequently Asked Questions.......................................................................................................15
Getting Support.................................................................................................................................16

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 3

How To Use This Manual


This manual documents the various parameters used in all expert advisors developed by
Dynamic Programming Solutions Corp. This is a generic parameters guide - an EA may not
have all the features and parameters listed on this document. On the other hand, not all
parameters found in expert advisors can be found on this manual. The amount of
parameters present in an expert advisor would depend on the strategy coded on it, as well
as the type of service selected (Standard or Premium).

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 4

Order Parameters
The following parameters are used for order processing:

• lotsize – the volume of each order opened by the EA.

• stoploss – the effective stoploss value of each order of an EA. It is expressed as a


pip distance of the stoploss price from the entry price.

• takeprofit – the effective takeprofit value of each order of an EA. It is expressed


as a pip distance of the takeprofit price from the entry price.

• _slippage_open – the maximum allowed amount of deviation (in pips) of the


preferred opening price from the latest available price, when the EA is opening
orders. If the slippage exceeds the amount specified in this parameter, the order
will not be executed.

• _slippage_close – the maximum allowed amount of deviation (in pips) of the


preferred close price from the latest available price, when the EA is closing orders.
If the slippage exceeds the amount specified in this parameter, the order will not be
closed.

• expiration_seconds – the expiration of pending orders expressed in seconds


(from the date the pending order was opened).

• order_comment – a field custom comment that can be used to label the orders
opened by the EA.

 You can specify an order comment to be able to easily identify the orders
opened by the EA on the terminal.

• _magic – a unique identifier of an expert advisor attached on the chart.

 Always set different magic numbers to EAs you attach on the charts. When
two or more expert advisors share the same magic number, it means that
those expert advisors are allowed to modify and close each others' orders!

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 5

 All orders manually opened are automatically assigned with a magic number
of 0. Any expert advisor assigned with the same magic number is allowed to
modify and close manually opened orders.

• _orderbymarket – (true or false) set this parameter to true when the broker
being used does not accept stop orders at order execution. This means that these
types of brokers will only accept orders with 0 stoploss and 0 takeprofit. The order
can be modified after the order has been successfully opened.


To easily identify whether or not your broker allows setting of stoploss and
takeprofit at order entry, open a new trade window. If the fields for stoploss
and takeprofit are greyed out, then the broker does not allow it. Set
_orderbymarket to true.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 6

Indicator Parameters
The parameters and parameter names for indicators used by an EA may vary depending
on the type of indicator(s) used. However, they can be generally classified according to
the following variables:

• bar – the indicator shift; the starting bar for calculations.

• timeframe – the timeframe to for indicator calculations (expressed in minutes). A


value of 0 indicates the current timeframe (chart timeframe).

 If more than one timeframe is used in the logic of an EA, they are usually
designated as tf1, tf2, tf3, etc.

• period – the period to consider on indicator calculations.

• method – the method used on calculations (some indicators only), e.g. simple,
exponential, smoothed, etc.

• applied_price – the price used on calculations (some indicators only) e.g. open
price, close price, etc.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 7

Trade Signal Management


The following parameters are used for the management of trade signals:

• reverse_strategy – enables/disables reverse strategy (true or false). When


activated, the EA will buy on a sell signal, and sell on a buy signal.

• trade_on_start – enables/disables trading upon loading the EA (true or false).


When activated, the EA will start trading (buy or sell) using trade signals upon
loading. When deactivated, the EA will wait for a trend reversal before landing its
first trade.

• trade_only_signal_change – enables/disables trading only on signal change


(true or false). When activated, the EA will only execute trades for each trend
reversal. When deactivated, the EA is allowed to open positions in the middle of a
trend.

• enableclose – enables/disables closing of all orders that oppose the current signal
(true or false).

• openafterclose – enables/disables opening of an opposite order when a certain


order was closed by the EA (true or false).

• trade_only_firsttick – enables/disables trading only on first tick of a bar. When


activated, the EA will only trade at the start of the bar. When deactivated, the EA is
allowed to execute orders regardless of whether the current bar has just opened or
about to close.

• signal_enabled – enables/disables the signals given by the indicator. The name of


the indicator is often inserted on the name of the external parameter (e.g.
signal_macd_enabled, signal_rsi_enabled, etc.). When activated, the indicator is
used for the evaluation of trading signals. When deactivated, the indicator signals
will be ignored by the expert advisor.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 8

Trailingstop Parameters (Stoploss)


The following parameters are used for implementing trailingstop:

• breakevenat – when the unrealized profit (in pips) of an order meets or exceeds
this amount, the order stoploss will be set to breakeven.

• breakeven_profit (premium package) – when the unrealized profit (in pips) of an


order meets or exceeds this amount, the order stoploss will be set to the entry
price + breakeven_profit pips.

• trailingstop – the effective stoploss value of an order for each trailing done on the
stoploss.

• trailingstop_activate – the minimum unrealized profit required for an order in


order for the EA to start trailing its stoploss.

• trailingstop_step – the minimum distance (in pips) for trailing. The distance is
measured from the current available price to the price where the last trailing of the
stoploss was done.

• stoptrailing – when the unrealized profit (in pips) of an order meets or exceeds
this amount, the trailing of the stoploss will be deactivated.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 9

Trailingstop Parameters (Takeprofit)


The following parameters are used for trailing the takeprofit value for each order:

• trailingtp – the effective takeprofit value of an order for each trailing done on the
takeprofit.

• trailingtp_activate – the minimum unrealized profit required for an order in order


for the EA to start trailing its takeprofit.

• trailingtp_step – the minimum distance (in pips) for trailing. The distance is
measured from the current available price to the price where the last trailing of the
takeprofit was done.

• stoptrailing_tp – when the unrealized profit (in pips) of an order meets or


exceeds this amount, the trailing of the takeprofit will be deactivated.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 10

Trading Time Filters


The following parameters are used to schedule the activation/deactivation of an EA:

• starthour – represents the hour to activate the EA (in combination with starthour)

• statrtminute – represents the minute to activate the EA (in combination with


starthour)

• endhour - represents the hour to deactivate the EA (in combination with


endminute)

• endminute - represents the minute to deactivate the EA (in combination with


endhour)

• TradeOnFriday – enables/disables trading on fridays (true or false).

 Depending on the EA logic, some days can also be chosen to be excluded


from trading, e.g. TradeOnMonday, TradeOnTuesday, etc.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 11

Order Limits
The following parameters set limits on the amount and/or types of orders opened by the
EA:
• long_enabled – enables/disables EA from opening long positions (true or false).

• short_enabled - enables/disables EA from opening short positions (true or false).

• maxorders – the maximum allowable amount of active orders on the chart. The
cap only applies to the orders opened by the EA (according to its magic number).

• oneperbar – enables/disables opening a maximum of one order per bar on the


chart (true or false). When activated, the EA will start opening additional orders on
a bar after the first one, even if there are strong signals to trade. When
deactivated, the EA is allowed to open an unlimited number of orders in a single bar
on the chart.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 12

Money Management
The following are the parameters used for money management:

• money_management – specifies the money management mode to use.

 Parameters for the different money management modes follow a certain


previx. Mode 1 parameters will always have the mm1 prefix; mode 2
parameters will have mm2; and mm3 for mode 3.

• lotsize – when money_management is 0, no money management mode is going to


be used. Rather, the EA will simply use the lotsize parameter to determine the
volume for each order.

• mm1_riskpercent – when money_management is equal to 1, this parameter


represents the percentage of the total deposit to risk on each trade. The amount of
lots to risk is automatically calculated from the risk percent amount (e.g. risk 2% of
total account deposit for each trade).

• mm2_ref_balance, mm2_ref_lot – when money_management is equal to 2, the


volume of each order would be mm2_ref_lot lots for every mm2_ref_balance (in
the deposit currency) balance on the account (e.g. 0.1 lot for every $10000 on the
account).

• mm3_risk_amount – when money_management is equal to 3, the lot size of each


order will be calculated according to the exact amount (in the deposit currency) the
trader wishes to risk per trade (e.g. risk $250 for each order).

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 13

Stealth
The following parameters are used for implementing virtual stops:

• stealth_sl – virtual stoploss value for each order.

• stealth_tp – virtual takeprofit value for each order.

Miscellaneous Parameters
The following are the parameters that are used in situational cases only. More often than
not, they are best left to their default values

• _sleep_ok – processing delay between order requests (required by broker).


• _sleep_err - processing delay between order requests after the broker has
rejected the previous one (required by broker).

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 14

How an EA Identifies the Bars on the Chart.


Expert advisors, as well as indicators, identify each bar on the chart by assigning numbers
to them. The candles are numbered 0, 1, 2, 3, 4... until it counts the last bar on the chart.
However, the the counting is being done in the reverse order – 0 is used to mark the
unformed bar, 1 for the previous bar, etc.

It is crucial to understand this so users of expert advisors would be able to identify which
bars are being considered by the EA in its calculations. For example, if we have an EA
using a simple moving average with a period of 14 and bar=1, the EA uses the last
formed bar as the starting bar for calculations, then count 14 bars back to identify the
ending bar for calculations.

Setting bar=0
When you set bar=0, the unformed bar will be considered in indicator calculations. Since
the prices for the unformed bar are not yet final (high, low, close), the indicator outputs
tend to fluctuate on that bar when its applied price is not yet final. Thus, this would cause
the signals to repaint on the current bar. Signals that came while the bar is forming may
not be the same when the bar has finally closed.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 15

Frequently Asked Questions

The EA executes only a few orders, and misses a lot of signals. What should I first do?
Make sure that the maxorders parameter is not preventing the EA from executing
additional orders. Also, make sure if long_enabled, and short_enabled are both set to
true.

There is a signal, but the EA executes trades one bar late?


Change the bar parameter value from 1 to 0, but be wary of false signals.

I want the EA to trade only on signal reversals.


Set trade_only_signal_change to true

The EA is not opening a position at trend reversals.


Set open_after_close to true.

I want my stoploss and takeprofit hidden from the broker.


If you have stealth parameters (stealth_sl and stealth_tp), use them instead of the
standard stoploss and takeprofit parameters.

Can I only activate stealth stoploss and keep my normal takeprofit?


Yes. Stealth for T/P and S/L are activated separately. They are activated by giving them a
value greater than 0, while setting the value of their standard counterpart to 0 (e.g. set
stoploss=0, and stealth_sl=5 or any value greater than 0, in order to activate virtual
stoploss).

I want the EA to only modify and close orders I manually opened. What should I do?
Set magic=0 and maxorders=0.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved
Expert Advisor Parameters Guide 16

Getting Support
In the case of unlisted parameters, or if you encounter issues with the parameters not
discussed in this document and do not know as to how to use them, please contact us at
support@metatraderprogrammer.com.

Copyright © Dynamic Programming Solutions Corporation


All Rights Reserved

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy