What's wrong ?

 


Hi,


Short quesiton... why it doesn't work ?


 
   if (AccountProfit()>Profit) //Réalise de le profit
   if (OrderSelect(Ticket1,SELECT_BY_TICKET)==true)
   OrderClose(OrderTicket(),Lot,Bid, 3);


It seems that AccountProfit doesn't work with "order select by ticket" .


When I write orderselect(0, select_by_Pos)... It woks ?


Do you have a solution ?


Thanks

 

I guess it's because var Ticket1 equal zero. Check.

 
Roger:

I guess it's because var Ticket1 equal zero. Check.

Try OrderProfit instead of AccountProfit

 
Nikas82:


Hi,


Short quesiton... why it doesn't work ?



It seems that AccountProfit doesn't work with "order select by ticket" .


When I write orderselect(0, select_by_Pos)... It woks ?


Do you have a solution ?


Thanks


You need to check the type of the opened trade too. If it is a buy trade you use Bid for closing, if it is a sell trade you use Ask for closing.