4756

 
#include <Trade/Trade.mqh> 
CTrade *P = new CTrade;
 

P.OrderModify(0,tick.bid,tick.ask+TS*_Point,0,ORDER_TIME_GTC,0);

It is designed to move stop loss.But instead gives error [invalid request] that tells nothing special. 

What could be the problem?

Please help. 

 


Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Order Properties - Documentation on MQL5
 
Learner21:
#include <Trade/Trade.mqh> 
CTrade *P = new CTrade;
 

P.OrderModify(0,tick.bid,tick.ask+TS*_Point,0,ORDER_TIME_GTC,0);

It is designed to move stop loss.But instead gives error [invalid request] that tells nothing special. 

What could be the problem?

Please help. 

 


You should specify the ticket of order you would like to modify.
 
alexvd:
You should specify the ticket of order you would like to modify.

Thank You. I try to find order ticket to specify it.

Looking at

ulong  Ticket() const
 

in Help menu, its syntax new for me.

I try to get ticket by the code but it says 

'Ticket' function is not defined. 

 I know the below code is wrong but how, need again to ask your help.

ulong ticket;
for(uint a=0;a<PositionsTotal();a++)
if(!PositionSelect(_Symbol))
   ticket = Ticket();
Print("ticket ", ticket);

	          
 
Np, I solved the problem.
Reason: