Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
where is the question exactly?
h ttps://www.mql5.com/ru/forum/115354/page78
in the code you gave, if there is only 1 order, the loop
The first time will be an attempt to select an order which does not exist
in the above code, if there is only 1 order, the loop will
The first time will be an attempt to select an order which does not exist
The terminal went into deep thought, after about 15 minutes I killed it
I would have killed it without waiting a minute.
Immediately before using Ask and Bid, execute RefreshRates()
Tried it, nothing changes
Order sending function, all seems to be standard
Tried it, nothing changes.
Order sending function, everything seems to be standard
First you refresh prices with function RefreshRates() and store the required price in Price.
Then you perform Sleep(Interval) and at this time the quotes change.
After that you call OrderSend() with the quote from the year before.
What do you expect in response?
First you refresh prices with function RefreshRates() and store the required one in Price.
Then you perform Sleep(Interval), and at that time the quotes change.
And after that you call OrderSend() with the quote from the year before.
What do you expect in response?
The function itself is now Does it look right now?My bad, I modernised a bit in the wrong place, now I've moved the price out of the function
Hello.
Could you tell me what type==4 means?
and type==5
in the following snippet:
double ma=iMA(Symbol(),PERIOD_D1,21,0,MODE_SMA,PRICE_CLOSE,0);
for(int k=1; k<=OrdersTotal(); k++)
bool select=OrderSelect(k-1,SELECT_BY_POS);
if(select)
{
int type=OrderType();
int ticket=OrderTicket();
if (Bid<ma && type==4)
OrderDelete(ticket);
if (Bid>ma && type==5)
OrderDelete(ticket);
}
I understand that conditions for deleting orders, by ma is clear, but together how ?
Thank you.
Doesn't that seem right now?
No it isn't. It got even worse :)
Understand, RefreshRates() updates the values of the predefined Ask and Bid variables, you are using the value once stored in the Price variable.