Questions from Beginners MQL5 MT5 MetaTrader 5 - page 175

 
Reshetov:

Am I doing something wrong? Trying the line
Alert("Time=",Time[0]);
zero to s doesn't work.
 
forexman77:
Maybe I'm doing something wrong? Trying to replace the line zero with s does not work.
Write exactly what you want to get (the essence of the algorithm). Also, is it an indicator, a script or an Expert Advisor?
 
barabashkakvn:
Write exactly what you want to get (the essence of the algorithm). Also - is it an indicator, a script or an Expert Advisor?

The time of formation of the bar found by the line below(the minimum found):

int s=ArrayMaximum(High,i,k);
No, it's not an indicator yet it's a script for testing. I will use it as an Expert Advisor in future. I will use it as an Expert Advisor in future.
 
forexman77:

The time of formation of the bar found by the line below(found minimum):

No it's not an indicator yet it's a script, to test. To learn. I will use it later for an EA.

Reduced the number of copied items - for easier viewing on the chart and understanding:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   double High[];
   datetime Time[];
   ArraySetAsSeries(High,true);  // индексация элементов массива будет производиться как в таймсериях
   ArraySetAsSeries(Time,true);  // индексация элементов массива будет производиться как в таймсериях
   int i=0;
   int k=10;
//--- копируем цены High баров от "i" в количестве "k"
   CopyHigh(_Symbol,_Period,i,k,High); // теперь в массиве High "k" элементов
   int s=ArrayMaximum(High);           // индекс бара с максимальным значением
   double Maxi=High[ArrayMaximum(High)];  // найдено значение High максимального бара
//--- копируем время Time баров от "i" в количестве "k"
   CopyTime(_Symbol,_Period,i,k,Time);   // теперь в массиве Time "k" элементов
//--- на данный момент в массивах High и Time "k" элементов и они соответствуют друг другу
   Alert("s=",s);
   Alert("Time=",Time[s]);
   Alert("Maxi=",Maxi);
  }
//+------------------------------------------------------------------+
 
barabashkakvn:

Reduced the number of copied elements - for easier viewing on the graph and understanding:

Great! Counts. Assumed to set indexing of elements, but didn't know how to do it.
 
The question is how to change the colour of sell-limit orders on the chart. they are green like the real orders. make them orange for example...
 
trora:
The question is how to change the colour of Sell Limit Bids on the chart. they are green like the real bids. make them orange or something...
We cannot do it through the colour scheme. But there is a connection between the colour of volumes and the colour of all orders: If we change the colour of volumes, all orders and orders will be of the same colour.
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы графиков / Свойства графиков - Документация по MQL5
 

The script needs to start counting an array from a certain date with a certain number of bars to search within that number of bars. It would be fine, but the search is performed from the specified time from right to left, while the search should be performed from the specified time and after it. The variant with start date and end date is not suitable, because there is no possibility to set the number of bars.

 
forexman77:

The script needs to start counting an array from a certain date with a certain number of bars to search within that number of bars. It would be fine, but the search is performed from the specified time from right to left, while the search should be performed from the specified time and after it. The variant with start date and end date is not suitable, because there is no possibility to set the number of bars.

Sketch a handwritten timeline and number the bars. Or use a screenshot to outline the situation (preferably against a white background).
 
barabashkakvn:
Sketch the timeline by hand and number the bars. Or on a screenshot outline the situation (preferably against a white background).

Recording the formation time of the maximum is not a problem. It is not clear how to tell the program to search in the next 8 bars for the minimum. That is, the bars before the maximum are not counted, the search is made in the bars after the maximum. The counting by time from and to is not suitable because it is impossible to specify the number of bars. The last bar to search in the chart is zero, we will consider that there are no bars after the last arrow.



Reason: