Can someone help me write code in MQL4 modifying the opened order? / Czy mógłby mi ktoś pomóc napisać kod w MQL4 modyfikujący otwarte zlecenia?

 

(English Version)

Can someone help me write code in MQL4 modifying the opened order?


I have in my EA the following variables:

takeprofit=100;
stoploss=50;
lots=0.1;
current_price; //the current market rate
price_of_opened_order; //the rate when the order was opened

-----------------------------------------------------------


In the meantime, some orders BUY and SELL were opened. Now we need to check (Every 30 seconds after the opening the order) whether there is no need to

change of the opened orders. Conditions for modification of the opened orders:


Every 30 seconds, I would like to check:

If there are opened BUY orders then:

If current_price+15pips>=takeprofit
{
takeprofit=current_price+30pips
stoploss=current_price-15pips
}

If there are opened SELL orders then:

If current_price-15pips<=takeprofit
{
takeprofit=current_price-30pips
stoploss=current_price+15pips
}


How to write the code in MQL4 modifying the opened orders by checking these conditions?


I have attached my EA, please if you can modify it and publish it on https://www.mql5.com/en/code or send me by e-mail on: bemowo@tlen.pl


Remark: variables current_price and price_of_opened_order are not defined on this EA yet.


=========================================================================================================================


(Polish version - polska wersja)

Czy mógłby mi ktoś pomóc napisać kod w MQL4 modyfikujący otwarte zlecenia?



Mamy w EA następujące Zmienne:

takeprofit=0;
stoploss=0;
lots=0.1;
current_price; //bieżący kurs rynkowy instrumentu
price_of_opened_order; //kurs instrumentu po którym otwarto zlecenie

W międzyczasie zostały otwarte jakieś zlecenia BUY oraz SELL.

Teraz trzeba sprawdzić (Co 30 sekund od momentu otwarcia zlecenia) czy nie należy zmodyfikować otwartych zleceń. Warunki modyfikacji otwartego

zlecenia/otwartych zleceń:

Co 30 sekund sprawdzamy:

Jeżeli otwarto zlecenie kupna to:

If current_price+15pips>=takeprofit
{
takeprofit=current_price+30pips
stoploss=current_price-15pips
}


Jeżeli otwarto zlecenie sprzedaży to:

If current_price-15pips<=takeprofit
{
takeprofit=current_price-30pips
stoploss=current_price+15pips
}

Jak napisać w MQL4 powyższy kod modyfikujący otwarte zlecenie przez sprawdzenie powyższych warunków?


Załączyłem moją strategię w pliku, jeśli potrafisz proszę opublikuj ją tutaj https://www.mql5.com/en/code lub prześlij mi mailem na adres: bemowo@tlen.pl


Uwaga: zmienne current_price oraz price_of_opened_order nie są zdefiniowane w tym EA.


=========================================================================================================================





Files:
matrix.mq4  33 kb
Reason: