XavierAndreu

Cerrar Beneficio perdida equity

Feb 3rd, 2023 (edited)
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. //Youtube-->https://youtu.be/DNOoRx-htDk
  2.  
  3. #include<Trade\Trade.mqh>
  4. CTrade trade;
  5.  
  6. input double beneficio=0.5;
  7. input double perdida=-0.5;
  8.  
  9. void OnTick()
  10. {
  11.  
  12. if(AccountInfoDouble(ACCOUNT_PROFIT)>=beneficio
  13.  
  14. ||
  15.  
  16. AccountInfoDouble(ACCOUNT_PROFIT)<=perdida)
  17. {
  18.  
  19. while(PositionsTotal()!=0)
  20. {
  21. ulong Ticket=PositionGetTicket(0);
  22. trade.PositionClose(Ticket,-1);
  23. }
  24.  
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment