MT4 EA Programming
If you have a profitable manual trading strategy, you can completely automate it. This will give you several advantages:
1. You will be able to test your strategy on historical data in fully automated mode, using MT4 tester.
Backtest will help you to find all weaknesses and improve strategy. For example if your strategy has loses on
certain days or hours, you can add day filters or time filters. Or if your strategy has not often repeat losing
trades (losses series), you can increase the size of the lot after each losing trades. Etc.
Possibility to define work days of the week
• MondayOn = true;
• TuesdayOn = true;
• WednesdayOn = true;
• ThursdayOn = true;
• FridayOn = false;
• SaturdayOn = false;
• SundayOn = false;
Trade time to open order from hh:mm to hh:mm
example: from 6:30 to 22:45 by ServerTime
Close open orders at CloseTime (CloseTime is external param)
a) only profitable
b) only losing
2. You can try other different features, which can improve your trading strategy
Dynamic lot calculation
a) as percent of Account Balance
b) as percent of Accout Equity
c) as percent of Account FreeMargin. So on increase of Account Balance/Equity/FreeMargin the lot size will growth too
Dynamic lot calculation with RiskPcnt option
You will enter an initial risk % of equity you can lose if StopLoss is triggered.
So if StopLoss = 50 pips, AccoutnEquity = 5000 and RiskPcnt = 10.0
then you will pay only 500$ on StopLoss.
Dynamic lot calculation by Martingale theory.
New lot will be multiplied by 2.0 (LotFactor = 2.0 is external parameter)
if previous lot was closed in loss.MaxLot of series will be second external parameter.
Make StopLoss, TakeProfit, TrailingStop hidden to brokers
In this case EA will manage Hidden (or invisible) stops
Standard (or visible) stops will be available too
Moves StopLoss to breakeven level when trade is in profit by X pips
Standard Trailing: simple trailing, stoploss follows by the market
High/Low Trailing: trailing by bars High/Low
ATR Trailing: trailing by ATR indicator
Fractals Trailing: trailing by Fractals
PSAR Trailing: trailing by Parabolic Stop And Reverse indicator
ProfitPcnt Trailing: trailing with lock of some pcnt of max. profit reached
TLine Trailing: trailing by some TrendLine added manual on the chart
MA Trailing: trailing by MovingAverage indicator
3. You will be able to optimize your strategy (parameters of indicators, stop loss, take profit) on historical data
in fully automated mode, using MT4 optimizer. You also can re-optimize your strategy time to time.
4. You also will be able to use all the benefits of automated trading, which are very difficult to implement
trading manually. For example you can improved Order Entry /Exit Speed. Since computers respond
immediately to changing market conditions, automated systems are able to generate orders as soon as
trade criteria are met. Getting in or out of a trade a few seconds earlier can make a big difference in the
trade's outcome. As soon as a position is entered, all other orders are automatically generated, including
protective stop losses and profit targets.
5. Automated trading systems minimize emotions throughout the trading process. By keeping emotions in
check, traders typically have an easier time sticking to the plan. Since trade orders are executed
automatically once the trade rules have been met, traders will not be able to hesitate or question the trade.
6. Automated trading systems permit the user to trade multiple accounts or various strategies at one time.
This has the potential to spread risk over various instruments while creating a hedge against losing positions.
Almost any manual trading system can be the automated, but you need to formalize trade rules, ie write an algorithm.
The following description will help you formalize your strategy
You should first consider when (rules for open position), what (symbol(s)), and how much (lot size) to buy and sell.
2. Exit point(s)
Next, consider when (rules for close position) do I want to close/hedge/lock the trade?
Wait for Stop Loss and Take Profit? Use trailing stop?
3. Number of open trades
Think about how many trades you want open at the same time.
4. Time frame
If the time frame is not specified, the time frame of the chart to which the Expert Advisor is attached will be used.
As soon as a trade is open, consider whether or not the action should be repeated. Generally the answer is "no".
However, it is very important to keep in mind that the majority of traders only show the entering conditions, which
the Expert Advisor fulfils at every tick.
6. Next trade
If at least one trade is placed, please point out when a new trade can be opened: (e.g. when this one is closed; when
the floating profit of this one is at least X pips; when the conditions on signs are fulfilled once again; even on the next
Unless otherwise pointed out, all the values of signs will be handled the present bar. All the crosses will be compared
with the previous bar or the one before it.
All trading conditions must be quantitatively clear and sensible. If the conditions are impractical, they may be difficult
to program or the outcomes your program creates will be arbitrary.
9. Variety of currency pairs.
Consider how many symbols (currencies, CFDs, etc.) you wish to make use of at the same time. It is typically advised
to trade on a couple of symbols. Note - unless specified, an Expert Advisor will trade only on the currency pair of the
plan to which it is connected. If you prefer trading on several currency pairs or MT4 symbols, the following solutions
a) Attach the Expert Advisor to several plans of different currency pairs;.
b) Program the Expert Advisor so that it deals with several currency pairs. In this case, you will not be able to optimize
and backtest your strategy.
10. Back testing and optimization. We can help you to test and optimize your expert advisor.
BJF Trading Group inc. offer MQL4, MQL5, JForex, FIX API programming
service for individual traders and brokerage companies.
Our company has developed:
• about 3000 expert advisors for MT4/MT5,
• most professional trade copiers: CopyTool and PowerTradeCopier
• most popular expert advisors: Stomper, TFOT
• arbitrage software
• DDE Tool
• Unique Elliott Indicator for MT4
• Unique Wolfe wave Indicator for MT4
• Divergence indicators Generation 3
• Social networks, PAMM, MAM, portals for brokerage companies
Will provide you with “clean” mql4, MQL5 or JForex code and the basic logic of the robot will be divided into
functions. Our professional robots never lose control and easily restore its last state after MT4 restarts. We are not
afraid of developing complex and integrated forex robots and find it interesting. We can suggest new ideas or see the
obvious errors in your description.
Please, send coding requests via e-mail: firstname.lastname@example.org