Download MetaTrader 5

Metatrader 5 Timeframe Change BUG??

To add comments, please log in or register
COSMOS4U - D. Vezeris & Co, L.P.
2117
Dimitrios Vezeris  

According to the video there is a BUG on Metatrader 5.



Usually the BUG occurs on higher than H1 timeframes.
After switching between them sometimes the bug is being fixed.

Vladimir Karputov
Moderator
61288
Vladimir Karputov  
Manifest error in the custom indicator.
Alain Verleyen
Moderator
32811
Alain Verleyen  
Dimitrios Vezeris:

According to the video there is a BUG on Metatrader 5.



Usually the BUG occurs on higher than H1 timeframes.
After switching between them sometimes the bug is being fixed.

Which bug ? Fix YOUR code.
COSMOS4U - D. Vezeris & Co, L.P.
2117
Dimitrios Vezeris  
Alain Verleyen:
Which bug ? Fix YOUR code.
According to this POST I posted here asking almost the same thing...

If you notice only the dots(arrows) have the problem.
In low Timeframes(M1-M30) there is not problem, but in higher it goes crazy and puts the dots whenever it wants.

The same code works on MT4 with the difference on loops:
//MT4
for (int j=lastPosition; j>=0; j--)
{...}

//MT5
for(int i=start; i<rates_total; i++)
I have tried two different aproaches for the dot buffers.
One is the same as I use in MQL4, for each color(4 colors) I use diferent buffer and when the lines crosses each other I put the same value as the blue line on the dot buffer and put zeros on the others:
DotArr01[k]=BlueLine[k];
DotArr02[k]=0.0;
DotArr03[k]=0.0;
DotArr04[k]=0.0;
And the second is by using one buffer and a color buffer.
int OnInit()
{
....
SetIndexBuffer(4,Dots,INDICATOR_DATA);
PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,NULL);
PlotIndexSetInteger(3,PLOT_DRAW_TYPE,DRAW_COLOR_ARROW);
PlotIndexSetInteger(3,PLOT_ARROW,159);
PlotIndexSetInteger(3,PLOT_LINE_WIDTH,3);
PlotIndexSetInteger(3,PLOT_DRAW_BEGIN,InpPeriod);
PlotIndexSetString(3,PLOT_LABEL,"Dot");

SetIndexBuffer(5,DotColor,INDICATOR_COLOR_INDEX);
PlotIndexSetInteger(3,PLOT_COLOR_INDEXES,4);
PlotIndexSetInteger(3,PLOT_LINE_COLOR,0,RoyalBlue);
PlotIndexSetInteger(3,PLOT_LINE_COLOR,1,OrangeRed);
PlotIndexSetInteger(3,PLOT_LINE_COLOR,2,LightBlue);
PlotIndexSetInteger(3,PLOT_LINE_COLOR,3,LightPink);

...
}//OnInit

switch(type)
{
case 0:
    Dots[shift]=BlueLine[shift];
    DotColor[shift]=0;
    break;
case 1:
    Dots[shift]=BlueLine[shift];
    DotColor[shift]=1;
    break;
case 2:
    Dots[shift]=BlueLine[shift];
    DotColor[shift]=2;
    break;
case 3:
    Dots[shift]=BlueLine[shift];
    DotColor[shift]=3;
    break;
}
I also tried freeing the arrays on init function, but the result was the same.

If you watch the video, you should notice 4 color dots, and 2 colored arrows(a yellow and an aqua).
On low Timeframes(M1-M30) the 2 arrows are not shown, but only on higher Timeframes.
That's because I don't put values on them, they are empty(never used in code), I only initialize them on OnInit function with PlotIndexSetDouble(4,PLOT_EMPTY_VALUE,0.0).

How can this be fixed?
To add comments, please log in or register