Download MetaTrader 5

Trailing code

To add comments, please log in or register
fxnew
189
fxnew  

Hello,


I tried to use the following line, to create a stop at a certain gain level and (at the same time) a takeprofit modification, but I probably made a mistake, since

the modification is not executed (the alert-sound is played sometimes):


extern int TicketBuy,TicketSell;

extern double       TrailingStopUp1;

extern double       TrailingStopLevelUp1;

extern double TakeprofitUp1;


if(

   (OrderSelect(TicketBuy, SELECT_BY_TICKET)==true) {    OrderSelect(TicketBuy, SELECT_BY_TICKET);   if(Bid>= TrailingStopUp1)  {OrderModify(TicketBuy,Bid,TrailingStopLevelUp1,TakeprofitUp1,"Buy1Comment",Blue); PlaySound("1wav.wav");}


maybe the  distance of the TP levels etc.(while testing..) were to close to the present Bid, I was wondering.

If anybody has hints, thanks in advance


Mike




whroeder1
15311
whroeder1  
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  3. Print out your variables, and find out why.
To add comments, please log in or register