stockengineer12: In real trading, I'm on M5. The open positions were at 8:05:50 and 08:06:36. |
|
WHRoeder:
stockengineer12: In real trading, I'm on M5. The open positions were at 8:05:50 and 08:06:36. |
|
So depending on when I start the EA, the bars may begin on those off times? That is, the bars for EURUSD started at 8:05:50 would be 8:05:50, 8:10:50, 8:15:50, etc.? So would my 5 min and zero seconds method work then? Probably not, it seems.
From the linked topic, I tried your code too. I'm guessing since you wrote it, you'd be an advocate of this for open bar only. I just want to see if I understand it. It starts the script and uses that as Time0. It says if the current time is the time of the bar start (Time[0]), return and set time Time0=Time[0]. Shouldn't it be something like if Time0 == Time[0] continue, else return?
int start(){ static datetime Time0; if (Time0 == Time[0]) return(0); Time0 = Time[0]; ...
stockengineer12: So depending on when I start the EA, the bars may begin on those off times? That is, the bars for EURUSD started at 8:05:50 would be 8:05:50, 8:10:50, 8:15:50, etc.?
int start(){ static datetime Time0; if (Time0 == Time[0]) return(0); Time0 = Time[0]; | You misunderstood me. If you started the EA at 8:09:50, your new Bar code would indicate new bars on the first tick received (8:09:50) and then first tick received on or after 8:10:00.0, etc. |
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
I've seen a few threads about this and tried one of them, but it doesn't seem to be working. The specific one I've referred to is: https://www.mql5.com/en/forum/133366.
The code that I'm using is:
In real trading, I'm on M5. The open positions were at 8:05:50 and 08:06:36. I thought of using something like below. Any validity to that? When I print the times in backtest for open position only, every output is a multiple of 5 for minutes and zero for seconds. Should I give seconds < 5 to allow a few seconds to purchase?