Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Pending order UP - MetaTrader 5 script | Grid EA download - MT4/MT5 resources - MetaTrader 5 resources

author EAcpu | 5 reads | 0 comments |

Pending orders UP - script for MetaTrader 5

The "Pending Orders Up" script sets a grid of orders above the current price.

Due to the use of asynchronous transaction operation mode :

 m_trade.SetAsyncMode( true );

Here is an example of sending five pending order requests:

 2017.08.28 08:50:22.246 Scripts script order UP (AUDCAD,Daily) loaded successfully 2017.08.28 08:50:24.095 Transaction '6121033': buy stop loss 0.01 at 0.99262 AUDCAD SL: 0.99011 TP: 0.99462
2017.08.28 08:50:24.095 Transaction '6121033': Buy Stop 0.01 at 0.99412 AUDCAD SL: 0.99161 TP: 0.99612
2017.08.28 08:50:24.095 Transaction '6121033': Buy stop 0.01 at 0.99562 AUDCAD SL: 0.99311 TP: 0.99762
2017.08.28 08:50:24.096 Transaction '6121033': Buy Stop 0.01 at 0.99712 AUDCAD SL: 0.99461 TP: 0.99912
2017.08.28 08:50:24.096 Transaction '6121033': Buy stop 0.01 at 0.99862 AUDCAD SL: 0.99611 TP: 1.00062
2017.08.28 08:50:24.097 Scripts Script Order UP (AUDCAD,Daily) Deleted

5 orders issued in 1 millisecond!

Here is the full report, from script start to deletion (the first order was sent at 2017.08.28 08:50:24.095) :

2017.08 . 28 08 : 50 : 22.246 Script Script Pending Order UP (AUDCAD, Daily) has been successfully loaded 2017.08 . 28 08 : 50 : 24.095 Transaction '6121033' : Buy Stop 0.01 AUD CAD 0.99262 SL: 0.99011 TP: 0.99462
2017.08 . 28 08 : 50 : 24.095 Transaction '6121033' : Buy Stop 0.01 AUD CAD 0.99412 SL: 0.99161 TP: 0.99612
2017.08 . 28 08:50 : 24.095 Transaction ' 6121033 ' : Buy Stop 0.01 AUD CAD 0.99562 SL: 0.99311 TP: 0.99762
2017.08 . 28 08 : 50 : 24.096 Transaction '6121033' : Buy Stop 0.01 AUD CAD 0.99712 SL: 0.99461 TP: 0.99912
2017.08 . 28 08 : 50 : 24.096 Transaction '6121033' : Buy Stop 0.01 AUD CAD 0.99862 SL: 0.99611 TP: 1.00062
2017.08 . 28 08:50 : 24.097 Script script pending order UP (AUDCAD, daily) has been deleted 2017.08 . 28 08 : 50 : 24.169 Transaction '6121033' : Accepted Buy Stop 0.01 AUD CAD 0.99262 SL: 0.99011 TP: 0.99462
2017.08 . 28 08 : 50 : 24.170 Transaction '6121033' : Order # 164991202 Buy Stop 0.01 / 0.01 AUDCAD Market Traded at 107.907 MS 2017.08 . 28 08 : 50 : 24.170 Transaction '6121033' : Accepted Buy Stop 0.01 AUD CAD 0.99412 SL: 0.99161 TP: 0.99612
2017.08 . 28 08 : 50 : 24.174 Transaction '6121033' : Order # 164991203 Buy Stop 0.01 / 0.01 AUDCAD Market Traded at 78.513 MS 2017.08 . 28 08 : 50 : 24.174 Transaction '6121033' : Accepted Buy Stop 0.01 AUD CAD 0.99562 SL: 0.99311 TP: 0.99762
2017.08 . 28 08 : 50 : 24.175 Transaction '6121033' : Order # 164991204 Buy Stop 0.01 / 0.01 AUD/CAD Market Traded at 79.283Multiple Sclerosis 2017.08 . 28 08 : 50 : 24.175 Transaction '6121033' : Accepted Buy Stop 0.01 AUD CAD 0.99712 SL: 0.99461 TP: 0.99912 2017.08 . 28 08 : 50 : 24.175 Transaction '6121033' : Accepted Buy Stop 0.01 AUD CAD 0.99862 SL: 0.99611 TP: 1.00062 2017.08 . 28 08 : 50 : 24.175 Transaction '6121033' : Order # 164991205 Buy Stop 0.01 / 0.01 AUDCAD Market Traded at 79.516 MS 2017.08 . 28 08 : 50 : 24.175 Trade '6121033' : Order # 164991206 Buy Stop 0.01 / 0.01 AUDCAD Market Traded at 79.565 MS

The last pending order was confirmed at 2017.08.28 08:50:24.175 . In total, all operations take just 80 milliseconds!

At the beginning of the script run, the correctness of the specified volume is checked for the number of pending orders:


Attachment download

📎 pending_orders_up.mq5 (14.16 KB)

Source: MQL5 #19024

Verification code Refresh