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
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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
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.
Enter LOGIN and PASSWORD from MQL5.community.
Where exactly is there one line?
Sorry, got confused with the terminal. Of course you only need to enter the LOGIN from MQL5.community.
I don't understand. I thought that's what we were doing in the condition.
Easy... do this...
#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;
}
}
}
//+------------------------------------------------------------------+
Thanks, but it's not showing any signs of life...maybe I did something wrong?
Several options are possible:
Well the system is x64, because I have 8GB RAM, and the system win 10, ok thanks disconnected the firewall now try again !
I don't understand. I thought that's what we were doing in the condition.