Edit Your Comment
help with an EA
May 19, 2010 zamanından beri üye
6 iletiler
Jun 18, 2010 at 11:40
May 19, 2010 zamanından beri üye
6 iletiler
Hi all,
need some help with an EA.
I have build most of it, but happend that it executed only 1 trade at time, and once I have a trade on it doesn't execute anything untill the trade is close...
I would like to have the EA executing up to 5 different trades,
and to open a new trade not earlier than 60 bars after last trade was open.
couls somebody help me?
thanks
need some help with an EA.
I have build most of it, but happend that it executed only 1 trade at time, and once I have a trade on it doesn't execute anything untill the trade is close...
I would like to have the EA executing up to 5 different trades,
and to open a new trade not earlier than 60 bars after last trade was open.
couls somebody help me?
thanks
Oct 28, 2009 zamanından beri üye
1409 iletiler
Jun 18, 2010 at 11:48
Oct 28, 2009 zamanından beri üye
1409 iletiler
You probably have code in there that checks existing orders and if there is one sets a flag. Something like.
IsTrade = True
This flag is then probably checked in the order creation routine. Something like
if ( !IsTrade )
You need to replace this with code to count trades using the OrdersTotal() built in function if you are checking both market and pending orders.
For the 60 bars thing then I would set up an
"int count = 60 "
when you raise an order and then use a new bar function to count it down.
NewBar function is here
bool NewBar()
{
static datetime lastbar = 0;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else
{
return(false);
}
}
Then use
if (NewBar() == true) Count = Count -1.
IsTrade = True
This flag is then probably checked in the order creation routine. Something like
if ( !IsTrade )
You need to replace this with code to count trades using the OrdersTotal() built in function if you are checking both market and pending orders.
For the 60 bars thing then I would set up an
"int count = 60 "
when you raise an order and then use a new bar function to count it down.
NewBar function is here
bool NewBar()
{
static datetime lastbar = 0;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else
{
return(false);
}
}
Then use
if (NewBar() == true) Count = Count -1.
11:15, restate my assumptions: 1. Mathematics is the language of nature. 2. Everything around us can be represented and understood through numbers. 3. If you graph these numbers, patterns emerge. Therefore: There are patterns everywhere in nature.
May 19, 2010 zamanından beri üye
6 iletiler
Jun 18, 2010 at 14:03
May 19, 2010 zamanından beri üye
6 iletiler
thanks a lot, later i will work it out, will tell you if I have been able
thanks
thanks
May 19, 2010 zamanından beri üye
6 iletiler
Jun 18, 2010 at 18:00
May 19, 2010 zamanından beri üye
6 iletiler
Hi,
I have implemented the max of 5 open trades;
but no luck with the 60 bars stuff...
please could you make it easier, or with more explanations?
thanks for your help.
I have implemented the max of 5 open trades;
but no luck with the 60 bars stuff...
please could you make it easier, or with more explanations?
thanks for your help.
Oct 28, 2009 zamanından beri üye
1409 iletiler
Jun 18, 2010 at 18:21
(Jun 18, 2010 at 18:24 düzenlendi)
Oct 28, 2009 zamanından beri üye
1409 iletiler
OKay, you need to put the newbar function either at the end of your program after all the other code or at the start, depending on where you generally define any functions.
Then in your initial variable declaration use
int count = 60;
Then within the init start section somewhere enter
if (NewBar() == true) count = count -1;
Then within your trade logic add the test for
count <= 0;
Then whenever you raise a new trade reset
count = 60;
I think! Kind of tricky to write code in my head.
Then in your initial variable declaration use
int count = 60;
Then within the init start section somewhere enter
if (NewBar() == true) count = count -1;
Then within your trade logic add the test for
count <= 0;
Then whenever you raise a new trade reset
count = 60;
I think! Kind of tricky to write code in my head.
11:15, restate my assumptions: 1. Mathematics is the language of nature. 2. Everything around us can be represented and understood through numbers. 3. If you graph these numbers, patterns emerge. Therefore: There are patterns everywhere in nature.
May 19, 2010 zamanından beri üye
6 iletiler
Jun 18, 2010 at 19:09
May 19, 2010 zamanından beri üye
6 iletiler
Hi, I have 2 errors
'count' variable not defined
where may I be wrong?
'count' variable not defined
where may I be wrong?
Oct 28, 2009 zamanından beri üye
1409 iletiler
Jun 18, 2010 at 19:20
Oct 28, 2009 zamanından beri üye
1409 iletiler
You need to declare it in your variables declaration section
int count = 60;
int count = 60;
11:15, restate my assumptions: 1. Mathematics is the language of nature. 2. Everything around us can be represented and understood through numbers. 3. If you graph these numbers, patterns emerge. Therefore: There are patterns everywhere in nature.
May 19, 2010 zamanından beri üye
6 iletiler
Jun 18, 2010 at 19:29
May 19, 2010 zamanından beri üye
6 iletiler
ok, here is a part of the code:
if I do this way, than I have 2x errors below:
int BarCount;
int Current;
bool TickCheck = False;
int Count = 60;
bool NewBar()
{
static datetime lastbar = 0;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else
{
return(false);
int init() { ERROR HERE:'(' function definition unexpected
BarCount = Bars;
if (EachTickMode) Current = 0; else Current = 1;
return(0);
if (NewBar() == true) BarCount = BarCount -1
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() { ERROR HERE:'(' function definition unexpected
return(0);
if I do this way, than I have 2x errors below:
int BarCount;
int Current;
bool TickCheck = False;
int Count = 60;
bool NewBar()
{
static datetime lastbar = 0;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else
{
return(false);
int init() { ERROR HERE:'(' function definition unexpected
BarCount = Bars;
if (EachTickMode) Current = 0; else Current = 1;
return(0);
if (NewBar() == true) BarCount = BarCount -1
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() { ERROR HERE:'(' function definition unexpected
return(0);
Oct 28, 2009 zamanından beri üye
1409 iletiler
Jun 18, 2010 at 20:23
Oct 28, 2009 zamanından beri üye
1409 iletiler
Put your newbar function at the very end of your code
11:15, restate my assumptions: 1. Mathematics is the language of nature. 2. Everything around us can be represented and understood through numbers. 3. If you graph these numbers, patterns emerge. Therefore: There are patterns everywhere in nature.
May 19, 2010 zamanından beri üye
6 iletiler
Jun 18, 2010 at 20:44
May 19, 2010 zamanından beri üye
6 iletiler
No errors, finally,
but now it doesn't trade at all.
but now it doesn't trade at all.

*Ticari kullanım ve istenmeyen e-postalara müsamaha gösterilmez ve hesabın feshedilmesine neden olabilir.
İpucu: Bir resim/youtube urlsi yayınlamak, onu otomatik olarak gönderinize gömer!
İpucu: Bu tartışmaya katılan bir kullanıcı adını otomatik olarak tamamlamak için @ işaretini yazın.