It works, but opens positions, not by condition, wherever it wants, ok
it cannot be so, my code is simple, like ZigZag, fractal has values only on the bars with arrows in the loop, look for indicator values before the arrow appears and exit the loop, return the fractal bar number
I have just made an Expert Advisor by fractals - the code is checked, and it turned out during the test that fractal on the bar number 1 may overdraw - turn on the visualization mode of the tester and add an indicator for fractal
it cannot be, my code is simple, the fractal, like ZigZag, has values only on the bars with arrows, in the loop, go through the indicator values until the arrow appears and exit the loop, return the number of bar on which the fractal is
I have just made an Expert Advisor by fractals - the code is checked, and it turned out during the test that fractal on the bar number 1 may overdraw - turn on the visualization mode of the tester and add an indicator for fractal
Maybe the result should be checked at 0 or empty value
Aleksei Beliakov: Maybe the result should be checked for 0 or empty value
there is 0 in empty values, well kinda not the best way to compare to _Point
it works, I don't want to prove it, but fractal indicator values should work with this part of the code
SZY: once again, for some reason I discuss my code.... the more the code works, I do not see the code of other participants, I do not understand who needs it in the end? ))))
PS:Checked, because I know that the question will not rest, everything works, the code is fast:
#property copyright"IgorM"#property link"https://www.mql5.com/ru/users/igorm"#property version"1.00"#property strict#property indicator_chart_window#property indicator_buffers2#property indicator_plots2//--- plot Label1#property indicator_label1"Label1"#property indicator_type1DRAW_ARROW#property indicator_color1clrRed#property indicator_style1STYLE_SOLID#property indicator_width11//--- plot Label2#property indicator_label2"Label2"#property indicator_type2DRAW_ARROW#property indicator_color2clrBlue#property indicator_style2STYLE_SOLID#property indicator_width21//--- indicator buffersdouble Label1Buffer[];
double Label2Buffer[];
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- indicator buffers mappingSetIndexBuffer(0,Label1Buffer);
SetIndexBuffer(1,Label2Buffer);
SetIndexArrow(0,SYMBOL_ARROWUP);
SetIndexArrow(1,SYMBOL_ARROWDOWN);
//---return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime &time[],
constdouble &open[],
constdouble &high[],
constdouble &low[],
constdouble &close[],
constlong &tick_volume[],
constlong &volume[],
constint &spread[])
{
//--staticint limit=0;
if(limit>=10) return(rates_total);
int b_up = 0, b_dn = 0;
while(limit<=10)
{
b_up = GetLastFractals(b_up,MODE_UPPER);
Label1Buffer[b_up] = high[b_up];
b_up++;
b_dn = GetLastFractals(b_dn,MODE_LOWER);
Label2Buffer[b_dn] = low[b_dn];
b_dn++;
limit++;
}
//--- return value of prev_calculated for next callreturn(rates_total);
}
//_______________________________________________________________________int GetLastFractals(int bar,int mode) // bar - с какого бара начинать поиск, mode = MODE_UPPER или MODE_LOWER , результат № бара где найден фрактал
{
int i=bar;
while(i<Bars && iFractals(NULL,0,mode,i)<_Point) i++;
return(i);
}
//_______________________________________________________________________
it cannot be, my code is simple, the fractal, like ZigZag, has values only on the bars with arrows, in the loop, go through the indicator values until the arrow appears and exit the loop, return the number of bar on which the fractal is
I have just made an Expert Advisor by fractals - the code is checked, and it turned out during the test that fractal on the bar number 1 may overdraw - switch on the visualization mode of the tester and add an indicator for fractal,
No, my position opens. As it should, on the third bar a fractal. But further it is worse. By my condition (fr1_up<fr_2 && fr1_down>fr2_down) it does not find. The essence is the compression of prices, which we find by two fractals
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.
Thank you, it works, only one condition is met:
And I need
It doesn't open a position for some reason.
It works, but it opens positions, not by condition, wherever it wants, all right
It works, but opens positions, not by condition, wherever it wants, ok
it cannot be so, my code is simple, like ZigZag, fractal has values only on the bars with arrows in the loop, look for indicator values before the arrow appears and exit the loop, return the fractal bar number
I have just made an Expert Advisor by fractals - the code is checked, and it turned out during the test that fractal on the bar number 1 may overdraw - turn on the visualization mode of the tester and add an indicator for fractal
it cannot be, my code is simple, the fractal, like ZigZag, has values only on the bars with arrows, in the loop, go through the indicator values until the arrow appears and exit the loop, return the number of bar on which the fractal is
I have just made an Expert Advisor by fractals - the code is checked, and it turned out during the test that fractal on the bar number 1 may overdraw - turn on the visualization mode of the tester and add an indicator for fractal
Maybe the result should be checked for 0 or empty value
there is 0 in empty values, well kinda not the best way to compare to _Point
it works, I don't want to prove it, but fractal indicator values should work with this part of the code
SZY: once again, for some reason I discuss my code.... the more the code works, I do not see the code of other participants, I do not understand who needs it in the end? ))))
PS:Checked, because I know that the question will not rest, everything works, the code is fast:
result
ArraySetAsSeries(true) for indicator buffers.
it cannot be, my code is simple, the fractal, like ZigZag, has values only on the bars with arrows, in the loop, go through the indicator values until the arrow appears and exit the loop, return the number of bar on which the fractal is
I have just made an Expert Advisor by fractals - the code is checked, and it turned out during the test that fractal on the bar number 1 may overdraw - switch on the visualization mode of the tester and add an indicator for fractal,
I think I did it !
I think I did it !
Which one?
object name move over iFractals