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

 
MakarFX:

This issue is solved in a simpler way:

Well, it's the same, there's elaboration for each timeframe, only through variables, the only thing we don't know is the idea, but we don't need that as we can come up with a great many of them.

 

Hello! Please help me to do the following:

there is a standard AO indicator

 AO_0 = iAO(NULL, PERIOD_M5, 0);
 AO_1 = iAO(NULL, PERIOD_M5, 1);




AO_0-15 = iAO(NULL, PERIOD_M15 , 0);
AO_1-15 = iAO(NULL, PERIOD_M15 , 1);




AO_0-30 = iAO(NULL, PERIOD_M30, 0);
AO_1-30 = iAO(NULL, PERIOD_M30, 1);




AO_0-1 = iAO(NULL, PERIOD_H1, 0);
AO_1-1 = iAO(NULL, PERIOD_H1, 1);

I need to make the signal work on red (down) and green (up) and simultaneously monitor the older timeframes,(PERIOD_M15 andPERIOD_M30,PERIOD_H1), so they would be the same colour.... So at M5 it catches the signal and the higher timeframes just as a filter...

I know how to do the crossover:

   if(AO_0 < AO_1)
     {
      сигнал вниз
     }
   if(AO_0 > AO_1)
     {
      сигнал вверх
     }

but how to track higher timeframes I don't!!! tell me please??

Документация по MQL5: Константы, перечисления и структуры / Константы графиков / Периоды графиков
Документация по MQL5: Константы, перечисления и структуры / Константы графиков / Периоды графиков
  • www.mql5.com
Все предопределенные периоды графиков имеют уникальные идентификаторы. Идентификатор PERIOD_CURRENT означает текущий период графика, на котором запущена mql5-программа.
 

How do I know the symbol has changed?

void OnDeinit(const int reason)
{
   // 3 - Символ или период графика был изменен
   if (reason == REASON_CHARTCHANGE)
   {

For some reason, these two events are combined into one, when I change TF I don't need to do anything, but when I change the symbol, I need to! I have to remember the current symbol in the object and compare it with the current one in OnInit(), it's not cool.

void OnDeinit(const int reason)
{
   // 6 - Активирован другой счет
   if (reason == REASON_ACCOUNT)
   {

Why is there no event when I change the account in MT4? Or maybe I got it wrong and it should not come? I have to do the same thing, save the account in the object on the chart and analyze it in OnTimer()

This is an indicator, not an Expert Advisor, MT4 build 1260
 

I need to create a point drawing, i.e. a picture in PBM format to create a graphic resource

Adobe Photoshop CS6 has this format


... but when I try to just open it and see this is what happens


... ... while the standard dot images in the folder MQL5/Images opens


What's the mistake?

 
Alexandr Sokolov:

I need to create a point drawing, i.e. a picture in PBM format to create a graphic resource

Adobe Photoshop CS6 has this format


... but when I try to just open it and see this is what happens


... while the standard point drawings from the MQL5/Images folder opens


What's the mistake?

You are confusing the PBM format with the BMP format, which is suitable for creating a resource.

 
Alexey Viktorov:

You are confusing the PBM and BMP format which is suitable for resource creation.

Thanks, didn't notice.

 
pivalexander:

How do I know the symbol has changed?

For some reason, these two events are combined into one, when I change TF I don't need to do anything, but when I change the symbol, I need to! I have to remember the current symbol in the object and compare it with the current one in OnInit(), it's not cool.

Why is there no event when I change the account in MT4? Or maybe I got it wrong and it should not come? I have to do the same thing, save the account in the object on the chart and analyze it in OnTimer()

I am talking about the indicator, not the Expert Advisor, MT4 build 1260

The problem is that when you switch TFs... and most likely any call of OnDeinit

a new indicator will be created, we discussedhttps://www.mql5.com/ru/forum/287677/page2#comment_9244404

You can detect what happened, but you won't be able to save it in indicator variables. The easiest way is to use global variables of the terminal - save.... there but this will be a problem if you use several copies of the indicator

it is not convenient in general

 

Good afternoon!

How can I disable"schedule shifting"?

Let me explain:

-- If you select "crosshair" (Crosshair, Ctrl+F), when you move the mouse (mouse) over the graph, the visible part of the graph DOES NOT MOVE (along the time scale).

-- If the crosshair is not used, then, when the left mouse button is held down, the graph RAPS (along the time scale), depending on the mouse movement direction (to the right/left).

The question is: how to achieve a static chart when moving the mouse with the left button depressed (as in the case of the enabled crosshair, but without enabling the "crosshair" mode) ?

Any recommendations would be welcome.

 
Maksims Ignatovs:

Good afternoon!

How can I disable"schedule shifting"?

Let me explain:

-- If you select "crosshair" (Crosshair, Ctrl+F), when you move the mouse (mouse) over the graph, the visible part of the graph DOES NOT MOVE (along the time scale).

-- If the crosshair is not used, then, when the left mouse button is held down, the graph RAPS (along the time scale), depending on the mouse movement direction (to the right/left).

The question is: how to achieve a static chart when moving the mouse with the left button depressed (as in the case of the enabled crosshair, but without enabling the "crosshair" mode) ?

Any recommendations would be welcome.

The best recommendation here is to read the help more often.

It lists the properties that can be retrieved/set for the graph.

In particular - scrolling the graph with the left mouse button.

Документация по MQL5: Операции с графиками / ChartSetInteger
Документация по MQL5: Операции с графиками / ChartSetInteger
  • www.mql5.com
Задает значение соответствующего свойства указанного графика. Свойство графика должно быть типов datetime, int, color, bool или char. Отданная команда поступает в очередь сообщений графика и выполняется только после обработки всех предыдущих команд. [in]  Номер подокна графика. Для первого варианта по умолчанию значение равно 0 (главное окно...
 

Dear traders, Good afternoon!

Happy holidays to all ...

Please help me with the following question

The indicator gives a signal to open a position from the beginning of a zero candle. How to make a delay of the signal one candle later, i.e. before opening a position, one should wait for one more candle and see what kind of candle it will be (bulls or bears). I will wait for the signal to start before opening a position.

Reason: