int TotalGridBuyOrders=0;
Print(__FUNCTION__);
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()==m_magic && m_order.OrderType()== ORDER_TYPE_BUY_STOP)
TotalGridBuyOrders++;
Print("Количество buy ордеров grid ", TotalGridBuyOrders);
if (TotalGridBuyOrders>=1)
{
grid_buy_price_memory=m_order.PriceOpen();
Print("Цена ближайшего buy grid ордера: ", grid_buy_price_memory);
int TotalGridSellOrders=0;
Print(__FUNCTION__);
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()==m_magic && m_order.OrderType()== ORDER_TYPE_SELL_STOP)
TotalGridSellOrders++;
Print("Количество sell ордеров grid ", TotalGridSellOrders);
if (TotalGridSellOrders>=1)
{
grid_sell_price_memory=m_order.PriceOpen();
Print("Цена ближайшего sell grid ордера: ", grid_sell_price_memory);
Why does the last print display the price fromORDER_TYPE_BUY_STOP
Данная функция предназначена для оформления исходного кода в соответствии с рекомендуемым стандартом. Это позволяет сделать код более читаемым, выглядящем профессионально. Грамотно оформленный код гораздо проще анализировать в последующем как его автору, так и другим пользователям. Для того чтобы запустить стилизатор, необходимо выполнить...
For the moment, the advice remains the same: use a styliser - you will see the errors visually.
... And only after that I will show you where your error is.
int TotalGridBuyOrders=0;
Print(__FUNCTION__);
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()==m_magic && m_order.OrderType()==ORDER_TYPE_BUY_STOP)
TotalGridBuyOrders++;
Print("Количество buy ордеров grid ",TotalGridBuyOrders);
if(TotalGridBuyOrders>=1)
{
grid_buy_price_memory=m_order.PriceOpen();
Print("Цена ближайшего buy grid ордера: ",grid_buy_price_memory);
int TotalGridSellOrders=0;
Print(__FUNCTION__);
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()==m_magic && m_order.OrderType()==ORDER_TYPE_SELL_STOP)
TotalGridSellOrders++;
Print("Количество sell ордеров grid ",TotalGridSellOrders);
if(TotalGridSellOrders>=1)
{
grid_sell_price_memory=m_order.PriceOpen();
Print("Цена ближайшего sell grid ордера: ",grid_sell_price_memory);
Here it is with the styler. But I can't see the error. That's why I ask in the subject
If the styler clearly showed you something - couldn't you tell me where the bracket should be?
Because it didn't clearly show me anything.
I need the price of the nearest buy stop and the nearest sell stop. How can I make the code differently?
I have highlighted the brackets that are missing pairs:
int TotalGridBuyOrders=0;
Print(__FUNCTION__);
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()==m_magic && m_order.OrderType()==ORDER_TYPE_BUY_STOP)
TotalGridBuyOrders++;
Print("Количество buy ордеров grid ",TotalGridBuyOrders);
if(TotalGridBuyOrders>=1)
{
grid_buy_price_memory=m_order.PriceOpen();
Print("Цена ближайшего buy grid ордера: ",grid_buy_price_memory);
int TotalGridSellOrders=0;
Print(__FUNCTION__);
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()==m_magic && m_order.OrderType()==ORDER_TYPE_SELL_STOP)
TotalGridSellOrders++;
Print("Количество sell ордеров grid ",TotalGridSellOrders);
if(TotalGridSellOrders>=1)
{
grid_sell_price_memory=m_order.PriceOpen();
Print("Цена ближайшего sell grid ордера: ",grid_sell_price_memory);
Where exactly to put the pairs depends on the logic of your code.
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.
if(OrdersTotal() < OrdersMax) OrderSend(...); else Alert("The required number of orders opened");
Thank you !
Why does the last print display the price fromORDER_TYPE_BUY_STOP
and not fromORDER_TYPE_SELL_STOP
Where is the error ?
Why does the last print display the price fromORDER_TYPE_BUY_STOP
and not fromORDER_TYPE_SELL_STOP
Where is the mistake?
Use the styler (Ctrl + ,) and you will see your mistakes...
Use the styler (Ctrl + ,) and you will see your mistakes...
I don't have a compilation error.
This code should output in Print the price of buy and sell orders.
The buy order price is output correctly but the sell order outputs the buy order price!
I don't have a compile-time error.
This code should output in Print the price of buy and sell orders.
The buy order price is correct, but the sell order price is correct!
At this point the advice is the same: use the styler - you will visually see the errors.
... and only then will I show you where your error is.For the moment, the advice remains the same: use a styliser - you will see the errors visually.
... And only after that I will show you where your error is.Here it is with the styler. But I can't see the error. That's why I ask in the subject
Questions from Beginners in MQL5
Here's the one with the stylizer. But I don't see the error. That's why I am asking in this thread
Questions from Beginners in MQL5
The styler has clearly shown that your code contains problems with closing parentheses. You need to fix it.
Shit, can anyone here help?
If the styler clearly showed you something - couldn't you tell me where the bracket should be?
Because it didn't clearly show me anything.
I need the price of the nearest buy stop and the nearest sell stop. How can I make the code differently?
Shit, can anyone here help?
If the styler clearly showed you something - couldn't you tell me where the bracket should be?
Because it didn't clearly show me anything.
I need the price of the nearest buy stop and the nearest sell stop. How can I make the code differently?
I have highlighted the brackets that are missing pairs:
Where exactly to put the pairs depends on the logic of your code.