Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 792

 
Is Ctrl+Alt+M so hard to press to insert code? As for the question - there are plenty of grid-advisors in the kodobase, look for something like this.
 
evillive:
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.
thank you very much
 
Vinin:
Candletime change
Thank you, but I don't quite understand the answer. Are you referring to

TimeCurrent

https://docs.mql4.com/ru/dateandtime/timecurrent


Ozero.

 
Ozero:
Thanks, but I don't quite understand the answer. Do you mean

TimeCurrent

https://docs.mql4.com/ru/dateandtime/timecurrent


Ozero.

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:

static datetime prevtime=0;                  
void OnInit()
{
   prevtime=Time[0];
}
void OnTick() 
{
{код, исполняемый на каждом тике}

   if(Time[0] <= prevtime) return;
   else      prevtime=Time[0];

{код, исполняемый на открытии нового бара}

}
 
evillive:

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

if(Time[0] <= prevtime) return;

Because if a new bar comes, prevtime will be equal to Time[1], which will always be lower than Time[0].

 
evillive:

So what's the problem? I think the solution is in bold...

I don't know how to convert the function to Unicode, that's what I'm asking.
 
AlexeyVik:

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?

 
tuner:

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.

The terminal draws objects with a step of 1 bar by X, i.e. the minimal drawing step is one M1 bar.
Reason: