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

Pending Order Decline - MetaTrader 5 Script | Grid EA Download - MT4/MT5 Resources - MetaTrader 5 Resources

author EAcpu | 6 reads | 0 comments |

The "Pending Orders Down" script sets a grid of orders below 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 09:00 : 30.227 Script script pending order down (AUDCAD, daily) loaded successfully 2017.08 . 28 09 : 00 : 35.272 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98893 SL: 0.99143 TP: 0.98693
2017.08 . 28 09 : 00 : 35.272 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98743 SL: 0.98993 TP: 0.98543
2017.08 . 28 09 : 00 : 35.273 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98593 SL: 0.98843 TP: 0.98393
2017.08 . 28 09 : 00 : 35.273 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98443 SL: 0.98693 TP: 0.98243
2017.08 . 28 09 : 00 : 35.273 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98293 SL: 0.98543 TP: 0.98093
2017.08 . 28 09 : 00 : 35.274 Script Script Pending Orders Drop (AUDCAD, Daily) Removed

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 09:00:35.272) :

2017.08 . 28 09:00 : 30.227 Script script pending order down (AUDCAD, daily) loaded successfully 2017.08 . 28 09 : 00 : 35.272 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98893 SL: 0.99143 TP: 0.98693
2017.08 . 28 09 : 00 : 35.272 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98743 SL: 0.98993 TP: 0.98543
2017.08 . 28 09:00 : 35.273 Transaction ' 6121033 ' : Sell Stop 0.01 AUD CAD 0.98593 SL: 0.98843 TP: 0.98393
2017.08 . 28 09 : 00 : 35.273 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98443 SL: 0.98693 TP: 0.98243
2017.08 . 28 09 : 00 : 35.273 Transaction '6121033' : Sell Stop 0.01 AUD CAD 0.98293 SL: 0.98543 TP: 0.98093
2017.08 . 28 09 : 00 : 35.274 Script Script Pending Order Drop (AUDCAD, Daily) Removed 2017.08 . 28 09:00 : 35.340 Transaction ' 6121033 ' : Accepted Sell Stop 0.01 AUD CAD 0.98893 SL: 0.99143 TP: 0.98693
2017.08 . 28 09 : 00 : 35.341 Transaction '6121033' : Order # 164992356 Sell Stop 0.01 / 0.01 AUDCAD Market Traded at 68.657 MS 2017.08 . 28 09:00 : 35.341 Transaction ' 6121033 ' : Accepted Sell Stop 0.01 AUD CAD 0.98743 SL: 0.98993 TP: 0.98543
2017.08 . 28 09 : 00 : 35.342 Transaction '6121033' : Order # 164992357 Sell Stop 0.01 / 0.01 AUDCAD Market Traded at 69.645 MS 2017.08 . 28 09 : 00 : 35.342 Transaction '6121033' : Accepted Sell Stop 0.01 AUD CAD 0.98593 SL: 0.98843 TP: 0.98393
2017.08 . 28 09:00 : 35.343 Transaction ' 6121033 ' : Order # 164992358 Sell Stop 0.01 / 0.01 AUD/CAD Market Traded at 70.006 Multiple Sclerosis 2017.08 . 28 09 : 00 : 35.343 Transaction '6121033' : Accepted Sell Stop 0.01 AUD CAD 0.98443 SL: 0.98693 TP: 0.98243 2017.08 . 28 09 : 00 : 35.343 Transaction '6121033' : Order # 164992359 Sell Stop 0.01 / 0.01 AUDCAD Market Traded at 70.346 MS 2017.08 . 28 09 : 00 : 35.343 Transaction '6121033' : Accepted Sell Stop 0.01 AUD CAD 0.98293 SL: 0.98543 TP: 0.98093 2017.08 . 28 09 : 00 : 35.343 Trade '6121033' : Order # 164992360 Sell Stop 0.01 / 0.01 AUDCAD Market Traded at 70.312 MS

The time when the last pending order was confirmed was 2017.08.28 09:00:35.343 . In total, all operations take just 71 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_down.mq5 (14.07 KB)

Source: MQL5 #19025

Verification code Refresh