Tango_X: Hello! What does the number of activations mean when you buy the program in the marketplace ? Can I use this program on different computers and different accounts at the same time? The point is that we want to buy one program for two people and use each of them separately
it is better to order from freelancers - the type of programme and it will be yours with open source code.
Fergert Фергерт: Please tell me how to check if an order of a certain type (in this case ORDER_TYPE_BUY_LIMIT ) or magic number is there and if it is closed, the EA will continue its work... I would be very grateful...
//--- вызов функцииint count_buy_limits=0,count_sell_limits=0,count_buy_stops=0,count_sell_stops=0;
CalculateAllPendingOrders(count_buy_limits,count_sell_limits,count_buy_stops,count_sell_stops);
//--- сама функция//+------------------------------------------------------------------+//| Calculate all pending orders |//+------------------------------------------------------------------+void CalculateAllPendingOrders(int &count_buy_limits,int &count_sell_limits,int &count_buy_stops,int &count_sell_stops)
{
count_buy_limits = 0;
count_sell_limits = 0;
count_buy_stops = 0;
count_sell_stops = 0;
for(int i=OrdersTotal()-1; i>=0; i--) // returns the number of current ordersif(m_order.SelectByIndex(i)) // selects the pending order by index for further access to its propertiesif(m_order.Symbol()==m_symbol.Name() && m_order.Magic()==InpMagic)
{
if(m_order.OrderType()==ORDER_TYPE_BUY_LIMIT)
count_buy_limits++;
elseif(m_order.OrderType()==ORDER_TYPE_SELL_LIMIT)
count_sell_limits++;
elseif(m_order.OrderType()==ORDER_TYPE_BUY_STOP)
count_buy_stops++;
elseif(m_order.OrderType()==ORDER_TYPE_SELL_STOP)
count_sell_stops++;
}
}
I want to close a position after Time has elapsed, I do this, but it doesn't work
if((TimeCurrent()-m_position.Time())>Time*3600) {CloseOrders=true; ClosePositions(POSITION_TYPE_BUY); break;} // если прошло много времени, закрываем !!!
//| Close positions по типу |//+------------------------------------------------------------------+void ClosePositions(constENUM_POSITION_TYPE pos_type)
{
for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of current positionsif(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==InpMagic)
if(m_position.PositionType()==pos_type) // gets the position type
m_trade.PositionClose(m_position.Ticket()); // close a position by the specified symbol
}
for(int i=PositionsTotal()-1;i>=0;i--)
if(m_position.SelectByIndex(i)) // selects the position by index for further access to its propertiesif(m_position.Symbol()==m_symbol.Name() && m_position.Magic()==InpMagic)
{
if(m_position.PositionType()==POSITION_TYPE_BUY)
{
Roman Kutemov: Time - in external settings time in hours. For example, 7 hours after opening position, if it has not closed at stop or take, I want to close it.
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.
Hello! What does the number of activations mean when you buy the program in the marketplace ? Can I use this program on different computers and different accounts at the same time? The point is that we want to buy one program for two people and use each of them separately
it is better to order from freelancers - the type of programme and it will be yours with open source code.
Please tell me how to check if an order of a certain type (in this case ORDER_TYPE_BUY_LIMIT ) or magic number is there and if it is closed, the EA will continue its work... I would be very grateful...
Example of counting four types of pending orders in Min Max for N Bars Martingale 2 code
Good afternoon.
I want to close a position after Time has elapsed, I do this, but it doesn't work
Good afternoon.
I want to close a position after Time has elapsed, I do this, for some reason it doesn't work
Who is'ClosePositions'?
And how do you select the position?
Who is'ClosePositions'?
And how do you select the position?
Who is'Time'? Set a breakpoint before issuing an order. Check if you hit a breakpoint at all?
(And yes: don't write multiple statements in one line)
Who is'Time'? Set a breakpoint before issuing an order. Check if you hit a breakpoint at all?
(And yes: don't write multiple statements in one line)
Time - in external settings time in hours. For example, 7 hours after opening position, if it has not closed at stop or take, I want to close it.
Forum on Trading, Automated Trading Systems and Strategy Tests
FAQ from Beginners MQL5 MT5 MetaTrader 5
Vladimir Karputov, 2021.01.27 17:49
*** Placea breakpoint before you issue an order. Do you ever check if you hit a breakpoint?
(And yes: do not write multiple operators in one line)
Yes, you didn't.
Corrected. Thank you.