[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 401

 
cocacoon >>:

Как из "double" значения получить время в формате datetime? И можно ли прозводить операции между 2 переменными в формате datetime? Просто TimeCurrent() возращает datetime, а остальные функции int значения.

Цель, получить отрезок начало и конец предыдущего дня по текущему времени, и на этом отрезки найти high и low.


Target iHigh("SYMBOL",PERIOD_D1,1); This is the previous day's High



 
Azimuth писал(а) >>

Can you please tell me what the problem is? I give two pieces of code that close all trades of the same direction:

and the second one:

Seems to be the same, only the second should close trades starting with the last, and the first should close starting with the first.

So, the first works correctly, all trades are closed, but the second closes only the very last trade and the rest are not. Why?

The list of orders in the terminal is dynamic while a pass in a cycle for() will be static - if we were told to pass from 0 (zero) to total-1 (the number of orders in the list before we start to remove orders minus one), it will be so. If there were 10 orders and we start from the beginning of the list (from the zero order in the list), then, after we have gone from 0 to 4, the list of orders will contain 5 orders and they will be placed on positions from 0 to 5 again. And passing from 5 to 9 in the loop will give blank shots, the remaining orders will not be closed or deleted. The correct way is to delete from the end of the list, then there will not be a collapse effect. The figure shows the order of deleting orders from the end of the list, the size of the list will decrease after each deletion/closing, and no order will be missed." - Excerpt from Closing and Deleting Orders https://www.mql5.com/ru/articles/mt4

 
Thanks for the help, but I'm still wondering how to convert a normal numeric value to datetime format.
 
cocacoon >>:
Спасибо за помощь, но все равно интересно как привести к формату datetime обычное числовое значение.

datetime TimeCurrent( )
Returns last known server time (time of last quote) as number of seconds elapsed since 00:00, January 1, 1970.

This is a numerical value that can be manipulated like the int format. But in order to understand whether it is data or time, we have to execute :

string TimeToStr( datetime value, int mode=TIME_DATE|TIME_MINUTES)
Converts value that contains the time in seconds elapsed since 01.01.1970 to string format "yyyyy.mm.dd hh:mi".




 
cocacoon >>:

Как из "double" значения получить время в формате datetime? И можно ли прозводить операции между 2 переменными в формате datetime? Просто TimeCurrent() возращает datetime, а остальные функции int значения.

Цель, получить отрезок начало и конец предыдущего дня по текущему времени, и на этом отрезки найти high и low.


simply assign a datetime or int variable to the value of a double variable, the fractional part will be discarded ...

use iBarShift to determine the bar number that corresponds to the time at which you want to get price data

 
Ether >>:
Доброго времени суток. Есть у меня один вопрос по оператору if. Представим, что в программе идет следующий оператор - if (A && B) { ... }, где A и B - некоторые условия. Понятно, что вся логическая формула истинна только тогда, когда истин каждый его компонент. Вопрос - MQL проверяет каждый оператор на истинность или все таки проверяет истинность каждой компоненты слева направо и если есть хоть одна ложная компонента, то прерывает работу и возвращает значение истинности - ложь?

https://docs.mql4.com/ru/basis/operations/bool

The calculation of the conditions is complete.

 
Azimuth >>:

Сократить то можно, но проблемы это не решает. Пробовал и OrdersTotal()-1, но это без разницы. Непонятно, почему при ii++ все работает, как надо, закрываются все ордера, например 2, 5, 6 и 10, а при ii-- только 10, а остальные остаются работать. Где тут собака зарыта?

For starters, check out https://docs.mql4.com/ru/basis/operators/return

In any case, you should have one order closed during the whole cycle. Open ten selves without bays and look at the results. The problem is probably not in these cycles, so dig elsewhere.

 
splxgf >>:

https://docs.mql4.com/ru/basis/operations/bool

Вычисление условий полное.

Thank you very much for your reply. Didn't see this section in the handbook.

 

Good afternoon! Please help! How to get time and price from x,y coordinates?

I am using IdleLib module dll to get x,y coordinates in Cartesian coordinate system. I need to get the time price coordinates to create a text object (OBJ_TEXT). Does anyone have an example

how to create a text object in this place with a mouse click? I really need it!

 
Does anyone know an indicator that draws trend lines on an oscillator or other oscillator?
Reason: