Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1090

 
Hello. Can someone tell me if it is possible to change the appearance of the cursor in MT4 in its own indicator, as for example when drawing a standard rectangle the cursor looks like a small cross?
 
avsem555:
Hello. Can someone tell me if it is possible to change the cursor view in MT4 in a custom indicator, e.g. when drawing a standard rectangle the cursor looks like a small cross?
Windows cursor cannot be changed using standard mql tools. But it is possible to draw your own one.
 
I see. Thank you.
 


Problem . After I downloaded the quotes, updated the chart and oh my god: the last 10 candlesticks are exactly the same as the previous ones. It would not affect the EA performance, but I would like to solve the problem.

Many thanks in advance.

 

Good afternoon. Help me how to select the last two open orders (which are still in the market)?

OrdersTotal() - displays the number of orders in the market.

OrderSelect (Select by position; Select_BY_Pos; Mode_trades) - how to access the last or last but one order in the list of "Orders in market" in this case?

 
Макс Сопельцев:

Good afternoon. Please, help me how to select the last two open orders (those which are still in the market)?

OrdersTotal() - outputs the number of orders in the market.

OrderSelect (Select by position; Select_BY_Pos; Mode_trades) - How to access the last or penultimate order in the "Orders in market" list in this case ?

Collect all orders into an array and sort them by time. The last two orders in the array will be the last and penultimate.

 
Artyom Trishkin:

Collect all orders into an array and sort them by time. The last two orders in the array will be the last and penultimate.


When new ones are added, how do I add them to the array?

Collect the orders in an array by Ticket?

 

I'll duplicate it here. https://www.mql5.com/ru/forum/334992

I need to get the last 30000 lines from the text file into the excel. In mql4 is it even possible to programmatically limit the number of lines in a text file (i.e. delete old lines and write new ones)? I think there was an article on 5, but I can't find it.

Ограничение числа записываемых строк
Ограничение числа записываемых строк
  • 2020.03.15
  • www.mql5.com
Здравствуйте. Есть советник, записывающий тики. Возможно ли ввести ограничение на количество строк в текстовом файле. Например...
 

Good afternoon. A simple question. I don't understand how custom functions work.

I want to make a custom function which will give out the number of open buy orders and separately sell orders.

I have written it, but it produces a lot of errors. Most likely, the error is in incorrect calling of the user function. I don't even really understand how it works. Formal variables, variables for output. Please help me.

void OnTick()
  {
  // Пользовательская функция "отчет об открытых ордерах."
  
  // Выводим 2 счетчика. Количество ордеров sell и ордеров buy
  
  int G, H = Otkr_Ord (a, b);
  Print ("Ордера Sell = ", G, "Ордера Buy = ", H)
  
  
  }
  
  int Otkr_Ord (int A, int B)
  {
  A = 0;
  B = 0;
  int z;
  for(z = OrdersTotal()-1; z >=0; z--)
  {
  if (! OrderSelect (PositionIndex, SELECT_BY_POS, MODE_TRADES))
  {
  if(OrderType () == 0 && OrderCloseTime == 0) 
  A++;
  if(OrderType () == 1 && OrderCloseTime == 0)
  B++; 
  }
  }
  return (G, H)
  }
 
Макс Сопельцев:

Afternoon. Please, help me to find the last two open orders (which are still in the market).

OrdersTotal() - outputs the number of orders in the market.

OrderSelect (Select by position; Select_BY_Pos; Mode_trades) - how to refer to the last or penultimate order in the list of "Orders in market" in this case ?

I have seen that there is a time comparison. I.e. times can also be compared more less.

There are 2 variables for the tickets separately.

Counter Orders

Check if it is still open

Write time in a variable

Into a variable

Compare times with the next one.

The last 2 with the longest time in the 2 variables.

Reason: