Mr.T0r0sTrades:
So I made this simple exponential and simple moving average expert advisor nothing crazy but I'm having trouble with giving a timer for every trade it enters whether it be long or short it updates the trailing stop loss every 20 minutes can someone help or at least provided some resource that can help?
Here is a simple example of how you can create a delay - in this case 3 secs. You could adjust this so it executes every 20 mins and apply it to your code where you need it
//+------------------------------------------------------------------+ //| 429041-Timedelay.mq5 | //| Copyright 2022, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2022, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" // //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ #define delayInSecs 3 datetime nextActionTime = 0; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { if(nextActionTime <= TimeCurrent()) { Alert(StringFormat("Alert at %s", TimeToString(TimeCurrent(), TIME_SECONDS))); nextActionTime = TimeCurrent() + delayInSecs; } } //+------------------------------------------------------------------+
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
So I made this simple exponential and simple moving average expert advisor nothing crazy but I'm having trouble with giving a timer for every trade it enters whether it be long or short it updates the trailing stop loss every 20 minutes can someone help or at least provided some resource that can help?