Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1844

 
Tretyakov Rostyslav #:

Your original code is correct.

Maybe there was something else wrong with it. I recreated his example in the script and it works. We add time, the line shifts to the right. That's basically how it should be.

 
EVGENII SHELIPOV #:

Here is the part of the code responsible for the vertical line on the graph. I have already considered the shift

There is an error in the moment of call to create the line

Here

Time[0] + PeriodSeconds(PERIOD_CURRENT) + (StartTime*3600)

you add two hours and one bar, so the reference comes one bar late.

Probably not the right order in

if(newbar!=Time[0])
 
Mihail Matkovskij #:

Maybe he had a problem with something else. I recreated his example in the script and it works. We add time and the line shifts to the right. That's basically how it should be.

Mikhail, you are right. It's just that the person is looking for a problem specifically in the creation of the line, but in fact the error is elsewhere)
 
Иван Макаров #:

Please help to insert the pause function into the EA.

In the tester, the pause (break point) is DebugBreak. During trading, you can simply exit the function (retutn). There is no other way to make it pause. Unless you use WinAPI. But in this case, we will have to create a clicker for the pause button.

 
Порт-моне тв Asian session prices. And it should be somehow calculated not point by point (because it will not be universal), but by each issuer's price deviation, and then a broken line of prices is formed and it all somehow sums up (their deviations).

Why this is needed: summary charts are very helpful in understanding this or that process, sector, industry, etc.

Try triple EMA or MACD or ATR for starters
 
Mihail Matkovskij #:

In the tester, the pause (breakpoint) is DebugBreak. While trading, you can simply exit the function (retutn). There is no other way to pause. Unless you use WinAPI. But in this case, we will have to create a clicker for the pause button.

No, Misha, it is possible to pause for trades.
 
Tretyakov Rostyslav #:
No, Misha, you can pause for trading.

So show me how, other than what I named, since you are an expert on the subject... Ivan is waiting for the right example.

 
Иван Макаров #:

Please help insert the pause function into the EA.

What exactly is it that you yourself are unable to do?
 
Mihail Matkovskij #:

So show me how, other than what I named, since you are an expert on the subject... Ivan is waiting for the right example.

input int HourPause = 2;   // Пауза в часах, "0" без паузы
datetime  Pause = 0;
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   if(наступило событие для паузы) Pause=TimeCurrent()+HourPause*3600;

   if(TimeCurrent()>=Pause)
     {
      можно торговать
     }
  }
//+------------------------------------------------------------------+
 
Tretyakov Rostyslav #:

Well, this is the pause I was talking about (if we are talking about working with real data). Only trade not in if but after return (exit, if paused). You can also manually turn off the robot in the menu (no problem here at all). And how do you pause in the tester (when you need to pause the tester programmatically)?

Reason: