MT5 Expert Advisor: Buy/Sell Based on Previous Candle Color (MQL5)

MQL5 Experts

Specification

Write an MQL5 Expert Advisor (EA) for MetaTrader 5.

Trading logic:
- On each new bar, check the last closed candle.
- If the candle is bearish (close below open), open a SELL.
- If the candle is bullish (close above open), open a BUY.
- If open equals close (doji), do nothing.

Inputs (adjustable by the user):
- Lot size
- Stop Loss in points
- Take Profit in points
- Maximum number of open positions allowed
- Magic number

Rules:
- Do not open a new trade if the maximum number of positions is already reached.
- Include only these features. No extra indicators, filters, or unnecessary options.
- Keep the code short, clean, and easy to read, with brief comments.
- Use the standard CTrade class.

Output:
- Provide the full .mq5 source code, ready to compile in MetaEditor and to publish on mql5.com.

Responded

1
Developer 1
Rating
(642)
Projects
750
35%
Arbitration
50
52% / 38%
Overdue
14
2%
Working
2
Developer 2
Rating
(295)
Projects
368
30%
Arbitration
37
27% / 65%
Overdue
10
3%
Working
Published: 10 codes
3
Developer 3
Rating
(64)
Projects
145
46%
Arbitration
21
38% / 24%
Overdue
32
22%
Free
4
Developer 4
Rating
(469)
Projects
823
49%
Arbitration
76
21% / 51%
Overdue
143
17%
Working
5
Developer 5
Rating
(637)
Projects
1009
47%
Arbitration
33
36% / 36%
Overdue
99
10%
Working
Published: 6 codes
6
Developer 6
Rating
(62)
Projects
90
29%
Arbitration
24
13% / 58%
Overdue
7
8%
Working
7
Developer 7
Rating
(111)
Projects
184
25%
Arbitration
25
16% / 76%
Overdue
16
9%
Free
8
Developer 8
Rating
(24)
Projects
32
38%
Arbitration
4
50% / 25%
Overdue
5
16%
Working
9
Developer 9
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
10
Developer 10
Rating
(5)
Projects
7
86%
Arbitration
0
Overdue
0
Free
Published: 4 codes
11
Developer 11
Rating
(1)
Projects
1
100%
Arbitration
0
Overdue
0
Working
Published: 7 codes
12
Developer 12
Rating
(11)
Projects
19
21%
Arbitration
3
0% / 67%
Overdue
3
16%
Loaded
13
Developer 13
Rating
(191)
Projects
205
47%
Arbitration
4
50% / 25%
Overdue
1
0%
Loaded
14
Developer 14
Rating
(61)
Projects
61
51%
Arbitration
1
0% / 100%
Overdue
1
2%
Free
15
Developer 15
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
16
Developer 16
Rating
(9)
Projects
11
73%
Arbitration
0
Overdue
0
Working
Published: 1 article, 2 codes
17
Developer 17
Rating
(1)
Projects
1
0%
Arbitration
0
Overdue
0
Free
Published: 4 codes
18
Developer 18
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
19
Developer 19
Rating
(1)
Projects
1
100%
Arbitration
0
Overdue
0
Free
20
Developer 20
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Published: 2 codes
21
Developer 21
Rating
(1)
Projects
4
50%
Arbitration
3
0% / 100%
Overdue
2
50%
Free
Published: 4 codes
22
Developer 22
Rating
(4)
Projects
5
60%
Arbitration
0
Overdue
1
20%
Free
23
Developer 23
Rating
(568)
Projects
866
61%
Arbitration
33
27% / 45%
Overdue
24
3%
Free
Published: 1 code
24
Developer 24
Rating
(2)
Projects
3
33%
Arbitration
0
Overdue
2
67%
Working
25
Developer 25
Rating
(25)
Projects
35
40%
Arbitration
9
22% / 33%
Overdue
5
14%
Loaded
Published: 9 articles, 35 codes
26
Developer 26
Rating
(4)
Projects
11
55%
Arbitration
1
100% / 0%
Overdue
0
Free
27
Developer 27
Rating
(2)
Projects
3
33%
Arbitration
0
Overdue
2
67%
Free
28
Developer 28
Rating
(45)
Projects
63
52%
Arbitration
5
0% / 40%
Overdue
1
2%
Free
29
Developer 29
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
30
Developer 30
Rating
(1)
Projects
1
0%
Arbitration
0
Overdue
0
Free
31
Developer 31
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Published: 7 codes
32
Developer 32
Rating
(268)
Projects
319
74%
Arbitration
16
75% / 0%
Overdue
6
2%
Working
33
Developer 33
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Published: 1 code
34
Developer 34
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Published: 2 codes
35
Developer 35
Rating
(3)
Projects
4
0%
Arbitration
1
0% / 100%
Overdue
0
Free
36
Developer 36
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
37
Developer 37
Rating
(60)
Projects
96
43%
Arbitration
4
0% / 100%
Overdue
4
4%
Free
38
Developer 38
Rating
(1)
Projects
1
0%
Arbitration
1
0% / 100%
Overdue
0
Free
39
Developer 39
Rating
(2)
Projects
2
50%
Arbitration
0
Overdue
1
50%
Free
40
Developer 40
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Published: 5 codes
41
Developer 41
Rating
(2354)
Projects
2960
63%
Arbitration
125
44% / 26%
Overdue
429
14%
Working
Similar orders
--- I need an MT5 Expert Advisor (EA) for Forex trading. Strategy: - Trade when fast Moving Average (9) crosses above slow Moving Average (21) = BUY - Trade when fast Moving Average (9) crosses below slow Moving Average (21) = SELL - Only 1 trade at a time Settings I want to change: - Lot size - Stop Loss in pips - Take Profit in pips - Trailing Stop - Trading hours (Start and End time) Risk: - Close all trades at
ICC SMART STRUCTURE EA 50 - 100 USD
DEVELOPMENT REQUIREMENTS Project Title: ICC Smart Structure EA – MT5 Automated Trading System 1. Project Objective I want a fully automated Expert Advisor (EA) for MetaTrader 5 (MT5), based on my Indication–Correction–Continuation (ICC) trading strategy. The EA must identify market structure, Break of Structure (BOS), swing highs and lows, supply and demand zones, corrections and continuation entries across multiple
The EA is already developed and functional, but there are some issues with its current behaviour that need to be investigated and corrected. **Requirements:** - Review the existing EA source code and identify the root cause of the issues. - Fix the existing problems without affecting other working functionalities. - Ensure the EA operates correctly under different market conditions. - Maintain the existing trading
Project Description I am looking for an experienced MQL5 developer with strong knowledge of FIX Protocol (Financial Information Exchange) to integrate FIX API connectivity into an existing MetaTrader 5 Expert Advisor. The main objective is to improve order execution speed, reduce execution latency, and minimize slippage, especially for high-frequency scalping strategies. Required Features 1. Integrate FIX Protocol
I want reading tradingviwer signal and want open mt5 account trades. Want reading stop loss size and take a profit size and when signalClosing ! This ea want cancel open trades
a { text-decoration: none; color: #464feb; } tr th, tr td { border: 1px solid #e6e6e6; } tr th { background-color: #f5f5f5; } I’m looking for a developer to create a fully automated trading bot (Expert Advisor) for MT5. I am not an expert trader, so the bot should have its own trading strategy, scan the market automatically, identify trading opportunities, and place buy/sell trades without manual input. It should
برمجة روبوت تداول MQL5 بهدف 50 نقطة مع إدارة مخاطر.مطلوب برمجة خبير تداول آلي يعمل على منصة MQL5، يركز على تحقيق هدف 50 نقطة مع إدارة صارمة للمخاطر وتحديد وقف الخسارة
I want full experience devloper need , I want devlope 4 Type Bot , Grd strategy 2 , and other bias strategy 2 scaning on market condition choose one order buy or sell and take profit and target fully automatic management, I am explain full details on private chat only experience developer contact me
Hello everyone, I am a final-year AI & Data Science student interested in building a career in algorithmic trading and EA development. I have good technical knowledge of MQL5, MT5 Expert Advisors, risk management, technical indicators, and automated trading strategies. I have also worked on building trading systems using Machine Learning and Neural Networks. I know how to develop EAs and trading strategies, but I am
Hello! I don't have time, but I bought some challanges and honestly I don't feel 100% confident yet for trading, I am eager to share prop firm account with good, profitable trader. 50% of profits are your, but first I need to make selection, I need to trust you somehow that you will not blow up account within few days. Only serious persons please, please don't waste me time and yours

Project information

Budget
70 - 100 USD
Deadline
to 10 day(s)

Customer

Placed orders1
Arbitrage count0