Errors, bugs, questions - page 3070

 
fxsaber:

I can't manage to write a function that only outputs true in the EA when the focus switches to the EA chart.

Can you give me a hint if you've encountered one.


Not enough CHARTEVENT on losing and gaining focus.

There's enough of everything. Somewhere it was sorted out that in the documentation is not true

CHART_BRING_TO_TOP

Show chart on top of all other charts

bool w/o

void OnChartEvent(const int id,         // идентификатор события
                  const long& lparam,   // параметр события типа long
                  const double& dparam, // параметр события типа double
                  const string& sparam  // параметр события типа string
                 )
 {
  if(id == CHARTEVENT_CHART_CHANGE)
   Print(bool(ChartGetInteger(ChartID(), CHART_BRING_TO_TOP)));
 }/******************************************************************/

Why at the moment of activation of window with this indicator true prints twice I did not understand, but loss of focus works fine.

Документация по MQL5: Константы, перечисления и структуры / Константы графиков / Примеры работы с графиком
Документация по MQL5: Константы, перечисления и структуры / Константы графиков / Примеры работы с графиком
  • www.mql5.com
Примеры работы с графиком - Константы графиков - Константы, перечисления и структуры - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Alexey Viktorov:

There's enough of everything. Sorted out somewhere in the documentation, which is not true

CHART_BRING_TO_TOP

Show chart on top of all other charts

bool w/o

Why at the moment of activation of window with this indicator true prints twice I haven't figured out, but loss of focus works fine.

This code behaves very badly when scrolling.

 
fxsaber:

This code behaves very badly when scrolling.

Well, yes, the code is crude. But there is a direction.

 
Alexey Viktorov:

Well, yes, the code is crude. But there is a direction.

Tried that direction too. Unfortunately, it's a dead end.

 
fxsaber:

Tried that direction too. Unfortunately, a dead end.

What's a dead end? It's easily solved...

Files:
 
Alexey Viktorov:

What's a dead end? It's easily solved...

  1. Run it on two charts.
  2. Maximize one.
  3. Minimize both of them.
  4. Now switch tabs between the charts and watch the logs.
Doesn't work, unfortunately.
 
fxsaber:

  1. Run on two charts.
  2. Maximise one.
  3. Minimise both.
  4. Now switch tabs between the charts and look at the logs.
It doesn't work, unfortunately.

Will there be new inputs next?

 
Alexey Viktorov:

Will there be new inputs next?

No. These are the replay steps when this approach doesn't work.

 
fxsaber:

No. These are the replay steps when this approach doesn't work.

But there is no word on that from the beginning

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

fxsaber, 2021.08.24 10:11

I can't write function, that would return true in EA, only when focus is switched to EA's chart.

Please advise who has run into this problem.


Not enough CHARTEVENT on losing and gaining focus.


 
Alexey Viktorov:

But there is no mention of this at the outset.

"when the focus switches to the EA chart" - so I do. No hidden inputs.