Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1199

 
Vitaly Muzichenko:

Maybe I don't understand something, but you should uselong tml = (long)ObjectGetInteger(ChartID(),vlines_name[i],OBJPROP_TIME); substitute line name, not index, otherwise you won't get results.

Yes, thank you very much. I added a line in loop and it works ))))

   for(int i = 0; i < vlines; i++)
   {
      vlines_name[i]    = ObjectName(ChartID(),i,0,OBJ_VLINE);
      long tml          = (long)ObjectGetInteger(ChartID(),vlines_name[i],OBJPROP_TIME);
      vlines_arr[i][0]  = tml;
      vlines_arr[i][1]  = (long)i;
   }
 

Hello: The task is to display candlesticks of 2 instruments on the chart, but one instrument is missing candlesticks in places. We should go through the bars of the instrument with all the data, comparing the time of bars of 2 instruments and when we come across a discrepancy, the loop should continue for 1 instrument and stop for another one until the bar times match, so that the chart has empty values where the bars are missing. How to do it?

 
How do I place an Expert on the marketplace?
The problem is, when adding an Expert, I need to select the type of Expert. My Expert belongs to "neuronet" type, I choose, add it, and then it turns out that it is impossible to use external API for getting data into Expert Advisor.
And how can a neural network work on end user's computer? Or should I attach a manual for installation of Tensoflow + Keras + Ta-Lib + a couple of scripts in python?

How this question is solved in practice? Surely someone has done experts on neural networks.
 

Good afternoon to all! Please advise or correct the code. It is required to draw a histogram on the zero bar, height 500, colour red.

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots   1
#property indicator_type1   DRAW_COLOR_HISTOGRAM
#property indicator_color1  Red
#property indicator_style1  0
#property indicator_width1  1
#property indicator_minimum 0.0


double                    ExtBuffer[];
double                    ExtColorsBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
//---- buffers   
   SetIndexBuffer(0,ExtBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,ExtColorsBuffer,INDICATOR_COLOR_INDEX);
   
//----
  }
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
  
  ExtBuffer[0]=500;
  ExtColorsBuffer[0]=Red;
   
   return(rates_total);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
 
EfDim:

Good afternoon to all! Please advise or correct the code. It is required to draw a histogram on the zero bar, height 500, colour red.

The zero bar is the leftmost bar. Current rates_total-1

 
Alexey Viktorov:

Zero bar, this is the leftmost bar. Current rates_total-1

Thanks mate!
 

Hello!

Please help me solve a problem.

//----------БЛОК 1---------
if(x)
 {
   func_1(a,b);
   ......
 }
//-----------БЛОК 2--------
if(z)
 {
  func(c,d);
  ....
 } 
//---------------------

These blocks need to work in the following modes:

1)Normal, i.e. as written, block conditions check sequentially

2)Block 1: check of condition x is canceled and code inside is not executed; Block 2: check of condition z is canceled and code inside is executed unconditionally

3)Block 1 : check of condition x is canceled and code inside is unconditionally executed; Block 2 : check of condition z is canceled and code inside is not executed

Switching modes should be done manually, in the EA settings.

(I only had enough imagination for switch, three variants of execution, but then the code is repeated, and I would like to avoid it. Is it possible?)

Торговые советники и собственные индикаторы - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
Торговые советники и собственные индикаторы - Алгоритмический трейдинг, торговые роботы - Справка по MetaTrader 5
  • www.metatrader5.com
Среди программ для автоматического трейдинга можно выделить две большие категории: торговые роботы и индикаторы. Первые предназначены для совершения торговых операций на рынках, а вторые — для анализа котировок и выявления закономерностей в их изменении. При этом индикаторы могут использоваться непосредственно в роботах, образуя полноценную...
 

Good afternoon.

There is a code like this:

         // Нормализация входных данных
         Print(TimeToString((datetime)vlines_arr[i][0]));
         Print("размер buf_Dsl = ",ArraySize(buf_Dsl));
         ArrayPrint(buf_Dsl);
         double d1         = 0.0;
         double d2         = 1.0;
         double x_min      = buf_Dsl[ArrayMinimum(buf_Dsl)];
         double x_max      = buf_Dsl[ArrayMaximum(buf_Dsl)];
         for(int n = 0; n < ArraySize(buf_Dsl); n++)
         {
            inp_Dsl[n]=(((buf_Dsl[n]-x_min)*(d2-d1))/(x_max-x_min))+d1; // array out of range
         }

I don't know why it's fighting...

2019.09.04 06:00
размер buf_Dsl = 6
 -7.25207 -12.75148 -14.52521 -13.95145 -12.49837  -3.17857
array out of range in '.....' (143,20)
How can I go outside the array?
 
Сергей Таболин:

Good afternoon.

There is a code like this:

I don't know why it frowns...

How do you go beyond the array?

Actually it is cursed atinp_Dsl[n]

 
Vladimir Karputov:

Actually it'sinp_Dsl[n] that's being cursed.

Right. Didn't set the size... Thank you.

Reason: