It means the time of a candle, Time[0] is the time of opening of the current candle. It should be compared with the time of the candle saved earlier in some variable, every tick. If the value in the variable is lower at the arrival of the next tick, it means that a new candle has appeared.
This way:
staticdatetime prevtime=0;
voidOnInit()
{
prevtime=Time[0];
}
voidOnTick()
{
{код, исполняемый на каждом тике}
if(Time[0] <= prevtime) return;
else prevtime=Time[0];
{код, исполняемый на открытии нового бара}
}
It means the time of a candle, Time[0] is the time of opening of the current candle. It should be compared with the earlier saved in some variable candle's time, every tick. If the value in the variable is lower at the arrival of the next tick, it means that a new candle has appeared.
And why would you want to use a global variable level?
I also don't understand why
After all, if there is a new bar, prevtime will be equal to Time[1], which will always be less than Time[0].
Static was written years ago and not by me, and in general, the structure has worked for several years without problems in the same form, and what works - do not touch it, it's an iron rule ))))
And about the logic in the second question, think again, you must have misunderstood something.
Hello, I have this indicator: total power. I work with it. I'm a complete stranger to programming, so I'm writing here in the hope for help and also in the hope that my question for a knowledgeable person will be simple and not complicated.
How can I paint these three numerical values in their own colours (on the screenshot they are marked with a dotted line)? That they would not be one gray colour. I also wanted to make them a little bigger?
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.
Is Ctrl+Alt+M so hard to press to insert code? As for the question - there's a lot of EAs in kodobase - gridlockers, look it up like this.
Candletime change
TimeCurrent
https://docs.mql4.com/ru/dateandtime/timecurrentOzero.
Thanks, but I don't quite understand the answer. Do you mean
TimeCurrent
https://docs.mql4.com/ru/dateandtime/timecurrentOzero.
It means the time of a candle, Time[0] is the time of opening of the current candle. It should be compared with the time of the candle saved earlier in some variable, every tick. If the value in the variable is lower at the arrival of the next tick, it means that a new candle has appeared.
This way:
It means the time of a candle, Time[0] is the time of opening of the current candle. It should be compared with the earlier saved in some variable candle's time, every tick. If the value in the variable is lower at the arrival of the next tick, it means that a new candle has appeared.
It looks somehow like this:
Why do you need static at the level of global variables?
I also don't understand why
Because if a new bar comes, prevtime will be equal to Time[1], which will always be lower than Time[0].
So what's the problem? I think the solution is in bold...
And why would you want to use a global variable level?
I also don't understand why
After all, if there is a new bar, prevtime will be equal to Time[1], which will always be less than Time[0].
Static was written years ago and not by me, and in general, the structure has worked for several years without problems in the same form, and what works - do not touch it, it's an iron rule ))))
And about the logic in the second question, think again, you must have misunderstood something.
Take two.
Is it possible to show the balance graph in a separate window, but without bar binding?
Thatis, to draw a curved line like the one in the strategy tester, so that it all fits in one window.
Hello, I have this indicator: total power. I work with it. I'm a complete stranger to programming, so I'm writing here in the hope for help and also in the hope that my question for a knowledgeable person will be simple and not complicated.
How can I paint these three numerical values in their own colours (on the screenshot they are marked with a dotted line)? That they would not be one gray colour. I also wanted to make them a little bigger?
Take two.
Is it possible to show the balance graph in a separate window, but without bars?
Thatis, to draw a curved line like the one in the strategy tester, so that it all fits in one window.