void ClosePositions()
{
for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of current ordersif(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==Magic)
m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol
}
Can you tell me how to change this function to find andclose a position that has an AAA comment?
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
At the moment there are 4 bays open with 1 lot each and 4cells with 1 lot each. The symbol is the same.
Only 1 buy and 1 sell is closed in this position.
void CloseBy()
{
ulong ticket_buy=ULONG_MAX;
ulong ticket_sell=ULONG_MAX;
for(int i=0;i<PositionsTotal();i++) // ATTENTION! Here, specially began a detour with "0"if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
{
if(m_position.PositionType()==POSITION_TYPE_BUY && ticket_buy==ULONG_MAX)
ticket_buy=m_position.Ticket();
if(m_position.PositionType()==POSITION_TYPE_SELL && ticket_sell==ULONG_MAX)
ticket_sell=m_position.Ticket();
}
if(ticket_buy!=ULONG_MAX && ticket_sell!=ULONG_MAX)
m_trade.PositionCloseBy(ticket_buy,ticket_sell);
//---return;
}
Nothing is closed at all in this position
void CloseBy()
{
ulong ticket_buy=ULONG_MAX;
ulong ticket_sell=ULONG_MAX;
for(int i=0;i<PositionsTotal();i++) // ATTENTION! Here, specially began a detour with "0"if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
{
if(m_position.PositionType()==POSITION_TYPE_BUY && ticket_buy==ULONG_MAX)
ticket_buy=m_position.Ticket();
if(m_position.PositionType()==POSITION_TYPE_SELL && ticket_sell==ULONG_MAX)
ticket_sell=m_position.Ticket();
}
if(ticket_buy!=ULONG_MAX && ticket_sell!=ULONG_MAX)
m_trade.PositionCloseBy(ticket_buy,ticket_sell);
//---//return;
}
What should I do to close all 4 buys and 4 sells counterclosed?
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.
Can you tell me how to change this function to find andclose a position that has an AAA comment?
Help:CPositionInfo
Access to text properties ...Thank you.
Also, could you please tell me why the implicit conversion from 'number' to 'string' is being swore at compilation
if(m_trade.Buy(InpLots,m_symbol.Name(),m_symbol.Ask(),sl,tp, "AAA")
What should the correct buy command look like?
Thank you.
Also, could you please tell me why the implicit conversion from 'number' to 'string' is being swore at compilation
if(m_trade.Buy(InpLots,m_symbol.Name(),m_symbol.Ask(),sl,tp, "AAA")
What should the correct buy command look like?
Reference:Buy.
Help:Conditional if-else statement
That's not how you wrote the code.
Here is the code
The compiler complains about"AAA "+chislo
That's not how you wrote the code.
Here is the code
The compiler complains about"AAA "+chislo
Reference:IntegerToString
Added: That's all for today. I'm already asleep.
That's not how you wrote the code.
Here is the code
The compiler complains about"AAA "+chislo
Vladimir Karputov, Alexey Viktorov
Thank you
Please advise on the code.
At the moment there are 4 bays open with 1 lot each and 4cells with 1 lot each. The symbol is the same.
Only 1 buy and 1 sell is closed in this position.
Nothing is closed at all in this position
What should I do to close all 4 buys and 4 sells counterclosed?