XavierAndreu

Cierre posición beneficio positivo negativo

Sep 10th, 2022
868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. //Youtube: https://youtu.be/__4S1lBsRSQ
  2.  
  3. #include<Trade\Trade.mqh> CTrade trade;
  4.  
  5. double beneficio=-0.5;
  6.  
  7. void OnTick()
  8. {
  9. for(int a=0; a<PositionsTotal() ; a++)
  10. {
  11. ulong Ticket=PositionGetTicket(a);
  12.  
  13. if(PositionGetDouble(POSITION_PROFIT)<=beneficio)
  14. {
  15. trade.PositionClose(Ticket,-1);
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment