Questions from Beginners MQL5 MT5 MetaTrader 5 - page 382

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
Which operator should be used to designatethe order type?
Combine 2 algorithms into one. (Combine them so there would not be a conflict of "OrdersTotal", it turns out that it will open 1 order. and I need 1 in each direction)
Thanks in advance))
int start ()
{
if (OrdersTotal() == 0 )
OrderSend("EURUSD",OP_BUY,Lots,Ask,0,0, "11",MagicNumb,0,Red);
}
int start ()
{
if (OrdersTotal() == 0 )
OrderSend("EURUSD",OP_SELL,Lots,Bid,0,0, "11",MagicNumb,0,Red);
}
Which operator should be used to designatethe order type?
Combine 2 algorithms into one. (Combine them so there would not be a conflict of "OrdersTotal", it turns out that it will open 1 order. and I need 1 in each direction)
Thanks in advance))
int start ()
{
if (OrdersTotal() == 0 )
OrderSend("EURUSD",OP_BUY,Lots,Ask,0,0, "11",MagicNumb,0,Red);
}
int start ()
{
if (OrdersTotal() == 0 )
OrderSend("EURUSD",OP_SELL,Lots,Bid,0,0, "11",MagicNumb,0,Red);
}
To open one by one.
If I have 0 orders it will open what I need.
I want it to open buy if there is no order to buy and vice versa (in the time when there is no 1 direction, 2 will open and the buy order will not start).
It will not work that way - when there are 0 orders it will open what I need.
I need it to open buy if there is no order to buy, and vice versa (while there is no 1 direction, there will be 2 and the start command will not be issued).
I have to count how many and open them if I do not have one.
count how many there are and, if the right one is missing, open
If I have 0 orders it will open what I need.
I want it to open buy if there is no order to buy and vice versa (in the time when there is no 1 direction, 2 will open and the buy order will not start).
I do not understand what you want. Is there any way to explain it more clearly?
If there is no Sell or Buy order in the market, it opens such an order no matter how many Buy orders are there.
And vice versa.
If there is no Sell or Buy order in the market, it opens such an order no matter how many Buy orders are there.
And vice versa.
We set two local variables in the OnTick function of the bool type: buyExist = false and sellExist = false.
When a new tick comes, you check if there are any orders that belong to the given EA. If there is a sell order, sellExist = true and the same thing with the buy order. And then you check if buyExist = true - do not open a buy order. The same is true for sell. That is all.