Wait to open
In my EA it opens a buy position and sell position when enabled. The problem is, I would like it to open a buy position and wait one pip (in either direction) to open the sell position. I am not sure how to do that.
if(total==0) // Open init lots
{
openorder("Buy",0.1);
BuyOpenPrice=Ask-(Point*10);
openorder("Sell",0.1);
SellOpenPrice=Bid+(Point*10);
return(0);
}
Thanks in advance.
naz:
I am not sure what the code you posted does, or what these methods and variables do, if you give more code maybe it would be clearer. But if I had to guess I think what you want is something like this:
//global
double price = 0;
bool sell = false;
// end global
if(total==0) // Open init lots
{
openorder("Buy",0.1);
BuyOpenPrice=Ask-(Point*10);
price = Close[0];
sell = true;
return (0);
}
if(MathAbs(price -Close[0])>=1 && sell)
{
sell = false;
openorder("Sell",0.1);
SellOpenPrice=Bid+(Point*10);
}
return(0);
Hazem Lotfy
Thank you for responding. I figured out a different solution. If you don't mind me asking, where are you from?
if(total==0) // Open init lots
{
openorder("Buy",0.1);
BuyOpenPrice=Ask-(Point*10);
openorder("Sell",0.1);
SellOpenPrice=Bid+(Point*10);
return(0);
}
Thanks in advance.