Opening and closing positions - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources

The author of this idea - Ilnaz
mq5 code author - Bara Bashkakon
The EA analyzes candles #1 and #2.
Sell opening and closing example

Opening conditions - no single position on the market
// - - buy if ((rate[ 1 ].open>rate[ 2 ].open) && (rate[ 1 ].close<rate[ 2 ].close)) { Double the lot size = TradeSizeOptimized(); open to buy(lots, 0.0 , 0.0 ); return ; } // - - sell if ((rate[ 1 ].open<rate[ 2 ].open) && (rate[ 1 ].close>price[ 2 ].close)) { Double the lot size = TradeSizeOptimized(); Open position (lots, 0.0 , 0.0 ); return ; }
If there is a position opened, check the closing status
Attachment download
📎 open_close.mq5 (25.33 KB)
Source: MQL5 #23090
Opening and closing positions - MetaTrader 5 experts | MT5 EA download - MetaTrader 5 resource usage and screening suggestions
Opening and closing positions - MetaTrader 5 experts | MT5 EA downloads - MetaTrader 5 resources belong to MT5 EA related resources. Before downloading or referencing, it is recommended to confirm the platform version, transaction type, time period, whether DLL is required, whether source code is included, parameter description and historical update records.
Both automated trading tools and foreign exchange indicators should first undergo backtesting, simulated account observation, and small capital verification. Pay special attention to spreads, slippages, maximum drawdowns, position opening frequency, stop loss methods, trading periods and broker rules, and avoid direct real-time execution based only on titles or short-term profit descriptions.
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •