Possible to run script every Interval (10 seconds)?

 
Try to run a script every so often to remove TP and SL on all open orders.
 
Samuel Manoel De Souza #:

scripts can't send or modify orders. it need be an EA. it can can be done in the timer event handler.

No, scripts can send and modify orders, https://book.mql4.com/basics/programms#:~:text=Only%20EAs%20and%20scripts%20can%20use%20trading%20functions

Program Types - Basics of MQL4 - MQL4 Tutorial
Program Types - Basics of MQL4 - MQL4 Tutorial
  • book.mql4.com
Program Types - Basics of MQL4 - MQL4 Tutorial
 
fxtrade76:
Try to run a script every so often to remove TP and SL on all open orders.

Scripts are intended to execute certain operations one time and then to be stopped

Instead of a script you can use an EA with the OnTimer function

Set the time interval you want in OnInt() with EventSetTimer(10) (10 seconds as example)

And place the code you want to be executed in OnTimer(){Your code is here}

Event Handling Functions - Functions - Language Basics - MQL4 Reference
Event Handling Functions - Functions - Language Basics - MQL4 Reference
  • docs.mql4.com
Event Handling Functions - Functions - Language Basics - MQL4 Reference
 
fxtrade76:
Try to run a script every so often to remove TP and SL on all open orders.
  1. HANY SAAD SHEHATA ABDELHALIM ABOUBAKR #: Instead of a script you can use an EA with the OnTimer function

    Exactly.

  2. No SL mean you have infinite risk. You really want to lose ½ of your account on a margin call?
 
William Roeder #:
  1. Exactly.

  2. No SL mean you have infinite risk. You really want to lose ½ of your account on a margin call?
It is in conjunction with an EA that closes an order via Telegram. I wanted to remove SL in order to avoid slippage and stop out from difference of broker spreads.
Reason: