naz:
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.
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
Hazem,
Thank you for responding. I figured out a different solution. If you don't mind me asking, where are you from?
Thank you for responding. I figured out a different solution. If you don't mind me asking, where are you from?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.