Download MetaTrader 5

Need help in improvement of EA WHICH WORKS!

To add comments, please log in or register
Have you developed a profitable strategy? Share it with millions of traders via Signals!
nick13
41
nick13 2015.02.16 21:13 
This is the one that i created, which does not work properly. 

The thing is, it has to open 2 positions sell and buy at the same time, after every hour (no matter what) (every new H1 bar).

In case if you need it anyway : TP is 100 SL is 50.

Any replay and advice will be accepted and appreciated!

You can keep EA for you as well, I do not have any copyrights. (But make it work properly first please!)

Stay green!
Files:
Keith Watford
Moderator
9648
Keith Watford 2015.02.16 23:40  

Please explain what you mean by "it does not work properly"

Tell us what the problem is, maybe somebody will be able to help you. 

nick13
41
nick13 2015.02.17 04:38  

thank you for you replay GumRai

there are two problems:

1 - It only opens long trades, but it has to open long and short trade at the same (exactly the same) time.

2 - We need EA to open new short and long orders every new hour, every new H1 bar (despite of if previous orders are still working). But it only opens second order, after the first one is closed (what is useless).


So it used to work like : 12:00 - sell buy; 13:00 - sell buy; 14:00 - sell buy; 15:00 - sell buy . . . (despite of order which was opened at 12:00, might still be working)

TP - 100 and SL - 50 for each and every entry.


hji
26
hji 2015.02.17 07:46  
nik13:

thank you for you replay GumRai

there are two problems:

1 - It only opens long trades, but it has to open long and short trade at the same (exactly the same) time.

2 - We need EA to open new short and long orders every new hour, every new H1 bar (despite of if previous orders are still working). But it only opens second order, after the first one is closed (what is useless).


So it used to work like : 12:00 - sell buy; 13:00 - sell buy; 14:00 - sell buy; 15:00 - sell buy . . . (despite of order which was opened at 12:00, might still be working)

TP - 100 and SL - 50 for each and every entry.


Is it even possible to open two trades concurrently?
nick13
41
nick13 2015.02.17 08:06  
hji:
Is it even possible to open two trades concurrently?
well, you can open two opposite trades manually, so why not?

Or do you mean that it does not make sense?
Keith Watford
Moderator
9648
Keith Watford 2015.02.17 09:09  
hji:
Is it even possible to open two trades concurrently?
No, an EA can only open 1 at a time. One order is processed, then the 2nd order is sent. There may only be milliseconds between the trades, depends on internet connection and how busy the server is.
Keith Watford
Moderator
9648
Keith Watford 2015.02.17 09:29  
nik13:

thank you for you replay GumRai

there are two problems:

1 - It only opens long trades, but it has to open long and short trade at the same (exactly the same) time.

2 - We need EA to open new short and long orders every new hour, every new H1 bar (despite of if previous orders are still working). But it only opens second order, after the first one is closed (what is useless).


So it used to work like : 12:00 - sell buy; 13:00 - sell buy; 14:00 - sell buy; 15:00 - sell buy . . . (despite of order which was opened at 12:00, might still be working)

TP - 100 and SL - 50 for each and every entry.


You will need to learn how to code. Try working through the logic of the EA and you will see why it doesn't do as you want.

First of all

if( TotalOrdersCount()==0 )

 controls the order opening, so it will not open any more orders at the next hour if a trade is already open.

It only opens a buy, because after the buy order is sent, you have

       return(0);

 So the sell order will not be sent.

The next tick, the buy order is open so no new orders will be opened.

There is nothing in your code that dictates that trades should be opened on the hour. 

nick13
41
nick13 2015.02.17 12:45  
GumRai:

You will need to learn how to code. Try working through the logic of the EA and you will see why it doesn't do as you want.

First of all

 controls the order opening, so it will not open any more orders at the next hour if a trade is already open.

It only opens a buy, because after the buy order is sent, you have

 So the sell order will not be sent.

The next tick, the buy order is open so no new orders will be opened.

There is nothing in your code that dictates that trades should be opened on the hour. 

 

Ok, so how should I change the options (what numbers do I have to wright there) to make it WORK? :( I'm not talking about to make him open positions every hour yet, for now goals is to make it open SELL and BUY order at the very same time as possible.

I guess you are the only one who's helping and I appreciate that.
whroeder1
14544
whroeder1 2015.02.17 13:04  
nik13:  Ok, so how should I change the options (what numbers do I have to wright there) to make it WORK? :
He told you what was wrong with your code - you need to change your code. learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
nik13: well, you can open two opposite trades manually, so why not?
Except with US brokers.
Keith Watford
Moderator
9648
Keith Watford 2015.02.17 13:33  
nik13:
Ok, so how should I change the options (what numbers do I have to wright there) to make it WORK? :( I'm not talking about to make him open positions every hour yet, for now goals is to make it open SELL and BUY order at the very same time as possible.

I guess you are the only one who's helping and I appreciate that.
I have already answered that question, because return(0) prevents the sell order being sent
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2015.02.17 13:58  
Yes. Usage of return(0) must be known for what purpose.
12
To add comments, please log in or register