Place Pending Order once certain Price reached

 
Hello!

Does MT4 have this function where, once a certain Price is met, a Pending Order will be then placed (Limit Order or Stop Order)?

Thank you all!
 
supercallim:
Hello!

Does MT4 have this function where, once a certain Price is met, a Pending Order will be then placed (Limit Order or Stop Order)?

Thank you all!

Yes, use the following function:

OrderSend

The main function used to open market or place a pending order.



int  OrderSend( 
   string   symbol,              // symbol 
   int      cmd,                 // operation 
   double   volume,              // volume 
   double   price,               // price 
   int      slippage,            // slippage 
   double   stoploss,            // stop loss 
   double   takeprofit,          // take profit 
   string   comment=NULL,        // comment 
   int      magic=0,             // magic number 
   datetime expiration=0,        // pending order expiration 
   color    arrow_color=clrNONE  // color 
   );
 

While cmd

[in]  Operation type. It can be any of the Trade operation enumeration.




Order Properties

Operation type for the OrderSend() function. It can be any of the following values:

ID

Value

Description

OP_BUY

0

Buy operation

OP_SELL

1

Sell operation

OP_BUYLIMIT

2

Buy limit pending order

OP_SELLLIMIT

3

Sell limit pending order

OP_BUYSTOP

4

Buy stop pending order

OP_SELLSTOP

5

Sell stop pending order

 
Mohammad Soubra:

Yes, use the following function:

While cmd

[in]  Operation type. It can be any of the Trade operation enumeration.




Order Properties

Operation type for the OrderSend() function. It can be any of the following values:

ID

Value

Description

OP_BUY

0

Buy operation

OP_SELL

1

Sell operation

OP_BUYLIMIT

2

Buy limit pending order

OP_SELLLIMIT

3

Sell limit pending order

OP_BUYSTOP

4

Buy stop pending order

OP_SELLSTOP

5

Sell stop pending order




hello Mohammad!


Thank you for responding. I am new to programmig EAs. May i know where do i copy and paste this? Metaquotes Editor?

 
supercallim:



hello Mohammad!


Thank you for responding. I am new to programmig EAs. May i know where do i copy and paste this? Metaquotes Editor?

Yes from there
Just press F1
Or visit
Book.mql4.com
 
Mohammad Soubra:
Yes from there
Just press F1
Or visit
Book.mql4.com

Thank you so much!! That is great!! :)

I appreciate your help so much!
 
supercallim:

Thank you so much!! That is great!! :)

I appreciate your help so much!
Great
 
Mohammed Abdulwadud Soubra #:
Great
Hello, I'm new to coding, I was wondering if you could help me with the final result of the script you ac hueved for the specified type of order. It will be great.

Reason: