Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1222

 
Aleksey Mavrin:

Needed )

Alexey, thank you!

Kindly tell an inexperienced person:
what role the MQL5/Sounds folder should (may) play in our lives? (my question is at the top of page 1221)

 

Can you please tell me why the bar changes its position on the chart only when a new tick arrives? MT5, Just2Trade build of June 5

#include <Controls\Dialog.mqh>
#include <Controls\Button.mqh>
CAppDialog Main;
CBmpButton nadpr, nadlos, nadot;
CBmpButton podpr, podlos, podot;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);
   Main.Create(0,"Main",0,50,50,260,130);
   Main.Run();
      
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Main.Destroy(reason);
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
void OnChartEvent(const int id,         // идентификатор события   
                  const long& lparam,   // параметр события типа long 
                  const double& dparam, // параметр события типа double 
                  const string& sparam)  // параметр события типа string
{
  Main.OnEvent(id,lparam,dparam,sparam);
}
 
Nikita Chernyshov:

Can you please tell me why the bar changes its position on the chart only when a new tick arrives? MT5, Just2Trade build of June 5

Compare your code and the example of the panel from the standard [data folder]\MQL5\Experts\Examples\Controls\Controls.mq5

 

Good afternoon, a question for connoisseurs:

I'm trying to build such a construction - a function, four variables are fed by links as parameters and an array, from which data for calculation of these four variables will be obtained inside the function. There are two such arrays (to be passed into the function) in the program - the upper and the lower extremums of the zigzag. The function should calculate points for drawing the TrendLine.

The question - how to check which of the two arrays is used in a particular iteration, to apply + or - to the calculation?

If awkwardly formulated, please ask again, I'll explain with pleasure. Attached here is an outline of construction.

//+------------------------------------------------------------------+ 
//| Вычисляем значения точек привязки трендовых линий                | 
//+------------------------------------------------------------------+ 
void CalculateTrendPoints(datetime &time_1, double &price_1, 
                          datetime &time_2, double &price_2, double &zigbuf[])  
{
   int ind_time_1, ind_time_2;
   int size_zigbuf = ArraySize(zigbuf);
   for(int i = 0; i < size_zigbuf; i++){if(zigbuf[i] != EMPTY_VALUE)break;}
      price_1    = zigbuf[i];
      ind_time_1 = i;
   for(int i = ind_time_1 + 1; i < size_zigbuf; i++){if(zigbuf[i] != EMPTY_VALUE)break;}
      price_2    = zigbuf[i];
      ind_time_2 = i;

   //Дальше будут расчеты, в которых в зависимости от того для чего используется функция
   //(построение ТрЛайн для верхних пиков или для нижних)будет применяться 
+ или - , < или >. 
   //Думаю что легче всего понять данное конкретное применение по тому, какой массив зашел в параметрах (&zigbuf[]), 
   //Вопрос не сложный - как это написать???   
} 

It means that thezigbuf[] parameter will have only two options to be substituted - either ZigzagPeakBuffer[] orZigzagBottomBuffer[]. How can I check inside the function, which of the options is currently set?


 

So far I've invented to determine which of the arrays is involved - by comparing the found value, which one matches, that one is ours. But surely there is a nicer and shorter solution.

Knowledgeable - tell us please !!!

//+------------------------------------------------------------------+ 
//| Вычисляем значения точек привязки трендовых линий                | 
//+------------------------------------------------------------------+ 
void CalculateTrendPoints(datetime &time_1, double &price_1, 
                          datetime &time_2, double &price_2, double &zigbuf[])  
{
   int ind_time_1 = 0;
   int ind_time_2 = 0;
   int size_zigbuf = ArraySize(zigbuf);
   for(int i = 0; i < size_zigbuf; i++)
      {
         if(zigbuf[i] != EMPTY_VALUE)
            price_1    = zigbuf[i];
            ind_time_1 = i;
            break;
      }
   for(int i = ind_time_1 + 1; i < size_zigbuf; i++)
      {
         if(zigbuf[i] != EMPTY_VALUE)
            {
               if(zigbuf[i] == ZigzagPeakBuffer[i] && zigbuf[i] > price_1)
                  {
                     price_2    = zigbuf[i];
                     ind_time_2 = i;
                     break;
                  }
               if(zigbuf[i] == ZigzagBottomBuffer[i] && zigbuf[i] < price_1)
                  {
                     price_2    = zigbuf[i];
                     ind_time_2 = i;
                     break;
                  }
            }
      }
   //Дальше будут расчеты, в которых в зависимости от того для чего используется функция
   //(построение ТрЛайн для верхних пиков или для нижних)будет применяться + или - , < или >.
   //Думаю что легче всего понять данное конкретное применение по тому, какой массив зашел в параметрах (&zigbuf[]), 
   // Вопрос не сложный - как это написать???   
}
 

Hello all))


Question: OBJ_FIBO does not give a pop-up window on the graph (OBJPROP_TOOLTIP) when plotting. Everything is organized graphically through OBJPOP_TXT/ How can and is it even possible to make a pop-up window in FIBO through tooltip?

Purpose: when hovering the mouse on the Fibo level, to pop up a window like in HLINE (as an example).

Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
  • www.mql5.com
При создании графического объекта функцией ObjectCreate() необходимо указать тип создаваемого объекта, который может принимать одно из значений перечисления ENUM_OBJECT. Дальнейшие уточнения свойств созданного объекта возможно с помощью функций по работе с графическими объектами.
 
kopeyka2:

Hello all))


Question: OBJ_FIBO does not give a pop-up window on the graph (OBJPROP_TOOLTIP) when plotting. Everything is organized graphically through OBJPOP_TXT/ How can and is it even possible to make a pop-up window in FIBO through tooltip?

Purpose : when hovering the mouse on the Fibo level, to pop up a window like HLINE (as an example).

Use the OBJPROP_TEXT property

ObjectSetString(chart_ID,name,OBJPROP_TEXT,"Это всплывающая подсказка");
 
How do I get rid of demo products that I don't use? I keep getting messages from system "New version ........".
 
Sergey Voytsekhovsky:

So far I've invented to determine which of the arrays is involved - by comparing the found value, which one matches, that one is ours. But surely there is a nicer and shorter solution.

People who know - please tell me!!!

Why do you make up your own problems? They will be enough as it is.

Just make two separate functions.

 
Can you tell me how to get aMqlParam array from a set file?
Reason: