Trade Start and End Time with Seconds
8 replies
EAWIZARD
8 years ago #114839
Is it possible to enter a trade at exactly a certain time (ex: 22:00:01 – notice seconds) and exit a trade a few seconds later (ex: 22:00:05 – notice seconds)?
If so, how would I go about setting up the above example in ea wizard?
tomas262
8 years ago #135624
Wizard does not have a function for seconds but you can do this by creating one. Copy this code into EA Wizard / code / CustomFunctions.mq4
int getSeconds() { return Seconds(); }
and use it as shown in the example attached.
Make sure you use the highest backtest precision in MetaTrader
EAWIZARD
8 years ago #135634
Hi Tomas thanks for your reply, I copied the code and pasted the code into EA Wizard / code / CustomFunctions.mq4 at the very bottom, and complied it. I’ve attached the customfunctions.mq4 file, please have a look and let me know if I did it correctly. Also, when I complied the file, it returned an error. Please take a look. Thanks
EAWIZARD
8 years ago #135636
Also, does Wizard have an option for milliseconds? possibly 100 or 500 milliseconds
tomas262
8 years ago #135681
This could be somehow supported with MetaTrader5 maybe. I would personally avoid using MetaTrader for this kind of operations and use strictly transparent market environment like futures markets http://www.investopedia.com/terms/f/futures.asp
EAWIZARD
8 years ago #135682
I will take a further look into futures, thanks. Moreover, I copied the code and pasted the code into EA Wizard / code / CustomFunctions.mq4 at the very bottom, and complied it. I’ve attached the customfunctions.mq4 file, please have a look and let me know if I did it correctly. Also, when I complied the file, it returned an error. Please take a look at the attachment. Thanks
tomas262
8 years ago #135685
You don’t need to compile CustomFunctions.mq4. It’s only a “plugin” (small portion of total code) into final EA code. EA code is compiled once requested to be used by MetaTrader.
You can surely open final EA in Editor and compile it. Then it should not contain any errors. Warnings are OK
EAWIZARD
8 years ago #135687
Could you check and see if I added the function of seconds code correctly to the above file, I copied and pasted the function at the very bottom.
tomas262
8 years ago #135694
Yes, correct
Viewing 8 replies - 1 through 8 (of 8 total)