Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1321
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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