• Sign up >>

Where is the correct place to put the SLEEP FUNCTION

To add comments, please log in or register
zlattin2000
19
zlattin2000  

Hi,

it looks i am struggling to find the answer. Searched over and over, but with no success.

I have same EA running on two charts EURUSD,same period. I need the second EA to execute trade with 20 secs delay from the first one.

I use:

void  Sleep(
   int  20000      // interval
   );

1.Is it correct?

2.Where is the correct place to paste the function code?

3.Should i just save it or compile it?


Many thanks,

Anthony Garot
3530
Anthony Garot  
zlattin2000:

I have same EA running on two charts EURUSD,same period. I need the second EA to execute trade with 20 secs delay from the first one.

Sleep() is usually not the best option with MT5.

Could you use the OnTimer() event to place the trade in 20 seconds?

zlattin2000
19
zlattin2000  
Anthony Garot:

Sleep() is usually not the best option with MT5.

Could you use the OnTimer() event to place the trade in 20 seconds?

Sorry, forgot to mention it is EA running on MT4.
Keith Watford
Moderator
21009
Keith Watford  
zlattin2000:

Do not double post.

I have deleted your other topic and will move this to the mql4 sub-forum.

William Roeder
20384
William Roeder  
  1. zlattin2000:  Sorry, forgot to mention it is EA running on MT4.
    Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. zlattin2000: I have same EA running on two charts EURUSD,same period. I need the second EA to execute trade with 20 secs delay from the first one.
    They both received the same tick and have decided to open. Why do you think you need a sleep?
zlattin2000
19
zlattin2000  
William Roeder:
  1. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
    Next time post in the correct place. The moderators will likely move this thread there soon.

  2. They both received the same tick and have decided to open. Why do you think you need a sleep?

too late i saw it is MT5 section, sorry. Anyway, i need that delay 20 secs as i am sending signals to ZuluTrade and there should be a time gap between two positions in order to be copied.

Thanks

zlattin2000
19
zlattin2000  
Keith Watford:

Do not double post.

I have deleted your other topic and will move this to the mql4 sub-forum.

Sorry to trouble you Keith, next time i will post in the correct sub-forum.
William Roeder
20384
William Roeder  
zlattin2000 i need that delay 20 secs as i am sending signals to ZuluTrade and there should be a time gap between two positions in order to be copied.

You have the code. Drop the second EA. Have the first send two orders. What's the problem?

zlattin2000
19
zlattin2000  
William Roeder:

You have the code. Drop the second EA. Have the first send two orders. What's the problem?

and what is the code to make EA to open two same orders with 20 secs delay between?
William Roeder
20384
William Roeder  
zlattin2000:  and what is the code to make EA to open two same orders with 20 secs delay between?
You already know. It's in your title.
  1. If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into yours.
  2. or pay (Freelance) someone to code it.
              Hiring to write script - General - MQL5 programming forum
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help
To add comments, please log in or register