MetaTrader 4: One-Cancels-Other (OCO) Order Execution
Info
The MetaTrader 4: One-Cancels-Other (OCO) Order Execution is a Expert Advisor for MetaTrader 4 that this tool facilitates the placement of one-cancels-other (oco) orders on the metatrader 4 (mt4) platform, specifically utilizing one pip for both limit and stop orders. Configuration Parameters:oco_buy_limit - Specifies the buy limit order price.
Usage
This tool is typically used for automated trading on major forex pairs and gold.
Platform
This Expert Advisor works exclusively on MetaTrader 4 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL4/Experts folder via File ? Open Data Folder in MetaTrader 4.
How to Install and Use MetaTrader 4: One-Cancels-Other (OCO) Order Execution
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
What this tool does
This tool facilitates the placement of One-Cancels-Other (OCO) orders on the MetaTrader 4 (MT4) platform, specifically utilizing one pip for both limit and stop orders.
Typical Use Case
This Expert Advisor excels in automated trading and technical analysis on MetaTrader 4.
Compatible Platform & Setup
This Expert Advisor works on MetaTrader 4. Place the file in the MQL4/Experts folder and restart the terminal.
Description & Settings
Related: Quantora Trade Manager MT4: Advanced Position Management for MetaTrader 4 - another powerful expert for MetaTrader 4 traders.
This tool facilitates the placement of One-Cancels-Other (OCO) orders on the MetaTrader 4 (MT4) platform, specifically utilizing one pip for both limit and stop orders.Also recommended: bad orders expert advisor for metatrader - similar expert with strong performance on MetaTrader 4.
Configuration Parameters:
oco_buy_limit - Specifies the buy limit order price.
oco_buy_stop - Specifies the buy stop order price.
oco_sell_limit - Specifies the sell limit order price.
oco_sell_stop - Specifies the sell stop order price.
oco_confirmation - Set to "1" to confirm and activate order placement after defining buy limit, buy stop, sell limit, or sell stop prices.
oco_lots - Defines the order volume (lots).
oco_oco - When set to "1", enables the one-cancels-other functionality, where the execution of one order cancels the other.
oco_sl_pips - Sets the stop loss in pips.
oco_tp_pips - Sets the take profit in pips.
This utility is designed for efficient order management in trading environments, allowing for strategic entry and exit points to be pre-defined and automatically managed.
Version 2026.
You may also like: gaps expert advisor for metatrader - excellent alternative for expert users on MetaTrader 4.
Source Code
#property copyright "robotfx"
#property link "https://robotfx.org"
string dtbahl()
{
string dt = "local time : "+ timetostr(localtime(),time_date|time_seconds)+
" "+((time[0]-time[1])/60)+" mins chart"+" [email protected]"+"\n"+
"bid :"+doubletostr(bid,digits)+" ask :"+doubletostr(ask,digits) +
" high :"+doubletostr(high[0],digits)+" low :"+doubletostr(low[0],digits);
return (dt) ;
}
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.