Reply

Trade Start and End Time with Seconds

8 replies

EAWIZARD

Subscriber, bbp_participant, community, 32 replies.

Visit profile

5 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?

0

tomas262

Administrator, sq-ultimate, 674 replies.

Visit profile

5 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

0

EAWIZARD

Subscriber, bbp_participant, community, 32 replies.

Visit profile

5 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

0

EAWIZARD

Subscriber, bbp_participant, community, 32 replies.

Visit profile

5 years ago #135636

Also, does Wizard have an option for milliseconds? possibly 100 or 500 milliseconds

0

tomas262

Administrator, sq-ultimate, 674 replies.

Visit profile

5 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

0

EAWIZARD

Subscriber, bbp_participant, community, 32 replies.

Visit profile

5 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

0

tomas262

Administrator, sq-ultimate, 674 replies.

Visit profile

5 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

0

EAWIZARD

Subscriber, bbp_participant, community, 32 replies.

Visit profile

5 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. 

0

tomas262

Administrator, sq-ultimate, 674 replies.

Visit profile

5 years ago #135694

Yes, correct

0

Viewing 9 posts - 1 through 9 (of 9 total)