Specification
I need an Expert Advisor (EA) for MT4 that automatically executes and close trades based on signals received from a Telegram channel. The EA must read Telegram messages, parse specific fields, determine BUY/SELL direction, and open trades according to predefined rules.
Telegram signal is received from specific TELEGRAM_TOKEN and CHAT_ID
Signal Parsing Requirements, I will provide signal samples.
Trade Execution
When a valid signal arrives:
- Determine BUY/SELL and close position from pattern.
- Open market order at nearest available MARKET PRICE
- Lot size (default 0.10)
- Avoid duplicate trades for the same symbol and same signal.
- Option to close previous trade when new signal arrives.
- Input parameter: Max_Open_Positions
- EA must NOT open new trades if this limit is reached.
- EA working hours
- Auto‑close at specific time
- Custom comments
Close Condition
- If symbol matches an open trade
- AND message contains specific phrase
Magic Number
- EA must use a unique magic number.
EA Risk & Trade Management Settings
Maximum Open Positions
- Input parameter: Max_Open_Positions
- EA must NOT open new trades if this limit is reached.
Maximum Positions Per Symbol
- Input parameter: Max_Positions_Per_Symbol
- EA must ignore new signals if symbols already have max trades.
Close Previous Trade on New Signal
- Input: Close_On_New_Signal (true/false)
- If true → EA closes old trade before opening new one.
EA Working Hours
Allowed Trading Hours ( GMT TIME )
Inputs: StartHour
EndHour
EA must:
- Only open trades between StartHour and EndHour
- Ignore signals outside working hours
- Still allow closing trades outside hours (configurable)
Auto‑Close at Specific Time
- Input: AutoCloseHour
- At this time EA must close ALL open positions (optional toggle):
- AutoCloseEnabled (true/false)
EA Inputs (Full List)
Trading Inputs
- LotSize
- SL (pips)
- TP (pips)
- MagicNumber
- Max_Open_Positions
- Max_Positions_Per_Symbol
- Close_On_New_Signal (true/false)
· Custom Comments
Time Inputs ( GMT )
- StartHour
- EndHour
- AutoCloseEnabled (true/false)
- AutoCloseHour
Direct Telegram API inside EA
Deliverables
- Fully working MT4 EA
- Installation instructions
- Full source code