Advertisement
XavierAndreu

Patrimonio cerrar

Mar 14th, 2023
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. //Youtube--> https://youtu.be/_fHLjZgkXJw
  2.  
  3. #include<Trade\Trade.mqh>
  4. CTrade trade;
  5.  
  6. input double Patrimonio_Gananacia=0;
  7. input double Patrimonio_Perdida=0;
  8.  
  9. void OnStart()
  10. {
  11.  
  12. if(AccountInfoDouble(ACCOUNT_EQUITY)>Patrimonio_Gananacia
  13.  
  14. ||
  15.  
  16. AccountInfoDouble(ACCOUNT_EQUITY)<Patrimonio_Perdida)
  17. {
  18. while(PositionsTotal()!=0)
  19. {
  20. ulong Ticket=PositionGetTicket(0);
  21. trade.PositionClose(Ticket,-1);
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement