Who else can help? How to make a pause in ticks or candlesticks (bars), not to fall asleep (Sleep), namely, for example, after closing a deal 100 bars do not trade, do nothing, so that the function works in the tester and on the real.
Функцию Sleep() нельзя вызывать из пользовательских индикаторов, так как индикаторы выполняются в интерфейсном потоке и не должны его тормозить. В функцию встроена проверка состояния флага остановки эксперта каждую 0.1 секунды.
Порт-моне тв: Who else can help? How to make a pause in ticks or candlesticks (bars), not to fall asleep (Sleep), namely, for example, after the transaction is closed for 100 bars, not to trade, do nothing, so that the function works in the tester and in the real account.
find the last closed order in the history with your magician and symbol
the time of closing will be available for this order
find out the current time every tick and subtract this time from the found time of a closed order and compare it with what you need, even in bars - a bar has an open time and the timeframe, or just in seconds
the only problem is the first order, when determining the last closed order, if it has not been found in the history, we should return 0, i.e. 1970.01.01.
I will not write the code - it should be in the KIM functions how to find the last closed order
find the last closed order in the history with your magician and symbol
the time of closing will be available for this order
find out the current time every tick and subtract this time from the found time of a closed order and compare it with what you need, even in bars - a bar has an open time and the timeframe, or just in seconds
the only problem is the first order, when determining the last closed order, if it has not been found in the history, we should return 0, i.e. 1970.01.01.
I will not write the code - it should be in the KIM functions how to find the last closed order
if (iBarShift(NULL,0, signalTime) < 100) return; // to skip.
your current bar is always zero and it's always less than 100, since NULL is less than STA you were written that you need time of last closed position and even specified where to look
there's even a function which returns bar number, you're all set
your current bar is always zero and it is always less than 100, because zero is less than CTA you were written that you need the time of the last closed position and even indicated where to look
there is even a function that returns the bar number, you are all set
Если указаны параметры start_time и stop_time, то функция возвращает количество баров в диапазоне дат. Если эти параметры не указаны, то функция возвращает общее количество баров. Если данные для таймсерии с указанными параметрами при вызове функции Bars() еще не сформированы в терминале, или данные таймсерии в момент вызова функции не...
Если указаны параметры start_time и stop_time, то функция возвращает количество баров в диапазоне дат. Если эти параметры не указаны, то функция возвращает общее количество баров. Если данные для таймсерии с указанными параметрами при вызове функции Bars() еще не сформированы в терминале, или данные таймсерии в момент вызова функции не...
Who else can help? How to make a pause in ticks or candlesticks (bars), not to fall asleep (Sleep), namely, for example, after the transaction is closed for 100 bars, not to trade, do nothing, so that the function works in the tester and in the real account.
find the last closed order in the history with your magician and symbol
the time of closing will be available for this order
find out the current time every tick and subtract this time from the found time of a closed order and compare it with what you need, even in bars - a bar has an open time and the timeframe, or just in seconds
the only problem is the first order, when determining the last closed order, if it has not been found in the history, we should return 0, i.e. 1970.01.01.
I will not write the code - it should be in the KIM functions how to find the last closed order
find the last closed order in the history with your magician and symbol
the time of closing will be available for this order
find out the current time every tick and subtract this time from the found time of a closed order and compare it with what you need, even in bars - a bar has an open time and the timeframe, or just in seconds
the only problem is the first order, when determining the last closed order, if it has not been found in the history, we should return 0, i.e. 1970.01.01.
I will not write the code - it should be in the KIM functions how to find the last closed order
You better tell me how it works.
int WaitXBars = 100;
datetime signalTime = TimeCurrent();
if (iBarShift(NULL,0, signalTime) < 100) return; // to skip.
It won't work in the tester. And what you've written is complicated and repulsive.
you'd better tell me how it works.
int WaitXBars = 100;
datetime signalTime = TimeCurrent();
if (iBarShift(NULL,0, signalTime) < 100) return; // to skip.
And what you have written is complex and repulsive.
I have nothing against it, wait, maybe someone will suggest a simpler way, I suggested the most reliable way
you'd better tell me how it works.
int WaitXBars = 100;
datetime signalTime = TimeCurrent();
if (iBarShift(NULL,0, signalTime) < 100) return; // to skip.
your current bar is always zero
and it's always less than 100, since NULL is less than STA
you were written that you need time of last closed position
and even specified where to look
there's even a function which returns bar number, you're all set
I have nothing against it, wait maybe someone will tell me how to make it easier, I suggested more reliable.
If possible, send me an example with the code on the deal, I have not found anything on the internet
If possible, send me an example of a transaction code, I can't find anything on the internet
https://www.mql5.com/ru/forum/131859
your current bar is always zero
and it is always less than 100, because zero is less than CTA
you were written that you need the time of the last closed position
and even indicated where to look
there is even a function that returns the bar number, you are all set
i can't understand it. where is the number of pending bars?
number ofwaitingbarsthen?
I don't understand, what is thenumber of bars towait for?
your example already says
only the time needs to be changed