Please help with EA code

 

Hi

Sorry for this question maybe it's an easy one

I use the OrderSend function to open a sell stop X distance from price

OrderSend (_Symbol,OP_SELLSTOP,0.05,Ask-100*_Point,3,NULL,NULL,NULL,778,0,Red);

Now I want to open a Buy Stop but only when the above Sell Stop is triggered and X points from sell stop

Thanks in advance

 
OrderSend (_Symbol,OP_SELLSTOP,0.05,Bid-100*_Point,3,NULL,NULL,NULL,778,0,Red);

Please use Bid price for sell orders.

To create another buy stop order you need to wait for the previous order to be executed. For that you can use trade transaction event.

https://www.mql5.com/en/articles/1111

MQL5 Cookbook: Processing of the TradeTransaction Event
MQL5 Cookbook: Processing of the TradeTransaction Event
  • www.mql5.com
This article considers capabilities of the MQL5 language from the point of view of the event-driven programming. The greatest advantage of this approach is that the program can receive information about phased implementation of a trade operation. The article also contains an example of receiving and processing information about ongoing trade operation using the TradeTransaction event handler. In my opinion, such an approach can be used for copying deals from one terminal to another.
 
Yashar Seyyedin #:

Please use Bid price for sell orders.

To create another buy stop order you need to wait for the previous order to be executed. For that you can use trade transaction event.

https://www.mql5.com/en/articles/1111

Hi Yashar


Thanks for the advice. 


I need for mql4 or will it be same


Regards

 
Ptr777 #:

Hi Yashar


Thanks for the advice. 


I need for mql4 or will it be same


Regards

Sorry for the wrong link. Mql4 does not support that. You have to check orders and positions yourself.
You can also check this link: https://www.mql5.com/en/forum/414851
 
Yashar Seyyedin #:
Sry for the wrong link. Mql4 does not support that. You have to check orders and positions yourself.
You can also check this link: https://www.mql5.com/en/forum/414851

Hi


Maby OrderSelect the last open order, check if it is buy/sell or buy stop/sell stop position and then open a buy or sell stop from that last order open price


but I need someone to assist with the code 


Regards 

 
Ptr777 #:

Hi


Maby OrderSelect the last open order, check if it is buy/sell or buy stop/sell stop position and then open a buy or sell stop from that last order open price


but I need someone to assist with the code 


Regards 

For assistance in code you need a freelancer. 

 
Yashar Seyyedin #: Sry for the wrong link. 
Ptr777 #: Maby OrderSelect the last open order, 

This is an international English forum; post in English on this part of the forums. "Sry" is not a word, "Maby" is not a word.
          Please don't write ur - it's "you are" or "your" - MQL4 programming forum (2014)

Reason: