Trailing code

Back to topics list To post a new topic, please log in or register
avatar
46
fxnew 2016.09.07 20:36
 

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




avatar
12995
WHRoeder 2016.09.07 21:19 #
 
  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.

Back to topics list  

To add comments, please log in or register