Amount of openorders Question
Hello,
I'm trying to code a EA that allows to open buy and sell orders simultaneously, but only one order per type. (open only one BUY order, and open only one SELL order). Could somebody please explain me how I can do this?
At the moment I am using if(OrdersTotal()<1) to block the EA form opening the second buy order. This method will also block the ea when I would like to open a sell. This is my code:
Don't forget to check your Trade Function return values and report all errors and relevant variables when they fail . . . What are Function return values ? How do I use them ?
- Can't be done. You can open a buy and THEN a sell, or the other way around. But not simultaneously.
- OrderSends take time, you need to refreshRates between the calls
- Hedging is not allowed in the US.
- Why, one wins, one looses and you pay the spread on both.
- Simplify your bools
// bool doji; // if(closeperc >= -0.0005 && closeperc <=0.0005) // doji = true; // bool doji = (closeperc >= -0.0005 && closeperc <=0.0005); bool doji = MathAbs(closeperc) <=0.0005);
- Can't be done.
Hello,
I'm trying to code a EA that allows to open buy and sell orders simultaneously, but only one order per type. (open only one BUY order, and open only one SELL order). Could somebody please explain me how I can do this?
At the moment I am using if(OrdersTotal()<1) to block the EA form opening the second buy order. This method will also block the ea when I would like to open a sell. This is my code: