Questions from Beginners MQL5 MT5 MetaTrader 5 - page 654

 
pako:

The bar number of the lower fractal is known

From it, search in the loop for the first high corresponding to the low of the known fractal

This can be done, but I would do vice versa. I.e. first find the high of the previous (formed) candle, and then the last fractal down. If they are the same, put a point.
 
Alexey Kozitsyn:
We could do that, but I would do the opposite. I.e. first we find the high of the previous (formed) candle, and then the last fractal down. If they coincide, we put a point.

I don't understand. I thought that's what we were doing in the condition.

if( High[i+1]==Low[isFractalDn()])//максимум первой свечи равен первому фракталу Dn
How should one write it?
 
Vladimir Karputov:
Enter LOGIN and PASSWORD from MQL5.community.
Where exactly is there one line
Files:
 
Ласло Подобедов:
Where exactly is there one line?
Sorry, got confused with the terminal. Of course you only need to enter the LOGIN from MQL5.community.
 
Vladimir Karputov:
Sorry, got confused with the terminal. Of course you only need to enter the LOGIN from MQL5.community.
Thanks, but it's not showing any signs of life...maybe I did something wrong?
 
mila.com:

I don't understand. I thought that's what we were doing in the condition.

if( High[i+1]==Low[isFractalDn()])//максимум первой свечи равен первому фракталу Dn
How do you write it down?

Easy... do this...

#property copyright "Tapochun"
#property link      "https://www.mql5.com/ru/users/tapochun"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2
//---
#property indicator_type1 DRAW_ARROW
#property indicator_width1 5
#property indicator_color1 clrAqua
#property indicator_type2 DRAW_ARROW
#property indicator_width2 5
#property indicator_color2 clrRed
//+------------------------------------------------------------------+
//| Глобальные переменные                                                                                                                       |
//+------------------------------------------------------------------+
double bufSell[];
double bufBuy[];
//+------------------------------------------------------------------+
//| Входные параметры                                                                                                                           |
//+------------------------------------------------------------------+
input int inpNum=50;    // Количество свечей для поиска последнего фрактала
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,bufBuy);
   SetIndexBuffer(1,bufSell);
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexEmptyValue(1,EMPTY_VALUE);
   SetIndexArrow(0,225);
   SetIndexArrow(1,226);
   IndicatorDigits(_Digits);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
   if(rates_total<=0 || prev_calculated<0)
      return( 0 );
//---
   if(prev_calculated>0) // Если не первый расчет индикатора
     {

     }
   else                         // Если первый расчет индикатора
     {
      ArrayInitialize(bufBuy,EMPTY_VALUE);
      ArrayInitialize(bufSell,EMPTY_VALUE);
      //---
      for(int i=1; i<rates_total-7; i++)
        {
         CheckBuyArrow(low[i],i,i+4,rates_total-3,time);
         CheckSellArrow(high[i],i,i+4,rates_total-3,time);
        }
     }
//---
   return(rates_total);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CheckBuyArrow(const double price,
                   const int index,
                   const int first,
                   int last,
                   const datetime &time[]
                   )
  {
   last=(first+inpNum-1<last) ? first+inpNum-1 : last;
   double iPrice;
//---
   for(int i=first; i<=last; i++)
     {
      iPrice=iFractals(_Symbol,_Period,MODE_UPPER,i);
      if(iPrice!=EMPTY_VALUE)
        {
         if(price==iPrice)
           {
            bufBuy[index]=iPrice-10*_Point;
            Print(__FUNCTION__,": "+TimeToString(time[index])+" - "+TimeToString(time[i]));
           }
         return;
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CheckSellArrow(const double price,
                    const int index,
                    const int first,
                    int last,
                    const datetime &time[]
                    )
  {
   last=(first+inpNum-1<last) ? first+inpNum-1 : last;
   double iPrice;
//---
   for(int i=first; i<=last; i++)
     {
      iPrice=iFractals(_Symbol,_Period,MODE_LOWER,i);
      if(iPrice!=EMPTY_VALUE)
        {
         if(price==iPrice)
           {
            bufSell[index]=iPrice+10*_Point;
            Print(__FUNCTION__,": "+TimeToString(time[index])+" - "+TimeToString(time[i]));
           }
         return;
        }
     }
  }
//+------------------------------------------------------------------+
Just counting on stories.
 
Ласло Подобедов:
Thanks, but it's not showing any signs of life...maybe I did something wrong?
There could be several possibilities:
  1. You have a 32-bit operating system. In that case you are not allowed to go.
  2. The time is short - it takes two minutes to join the cloud.
  3. Possible ports closed by firewall - need to look at agent logs.
 
Vladimir Karputov:
Several options are possible:
  1. You have a 32-bit operating system. In that case you are not allowed to go.
  2. The time is short - it takes two minutes to join the cloud.
  3. Possibly ports are blocked by firewall - you need to look at agent logs.
well the system is x64 because i have 8gb RAM and the OS is win 10, ok thanks i disabled firewall now i will try again !
 
Ласло Подобедов:
Well the system is x64, because I have 8GB RAM, and the system win 10, ok thanks disconnected the firewall now try again !
Do you know how to find out the TCP port I just downloaded the metatester separately ...
 
mila.com:

I don't understand. I thought that's what we were doing in the condition.

if( High[i+1]==Low[isFractalDn()])//максимум первой свечи равен первому фракталу Dn
How do you write it down?
Look in the box.