Errors, bugs, questions - page 1393

 
galustyan10:

HELLO, COULD YOU ADVISE ME, WHEN I OPEN A REAL ACCOUNT ON MT5, HOW LONG DOES IT TAKE FOR A COMPANY EMPLOYEE TO CALL ME AND COMPLETE THE ACCOUNT OPENING PROCEDURE?

Why are you shouting? You receive your login and password when you register your account. Usually it is a personal account on the broker's website.

 
Compilation error:'a' - is not static member
class A     { int a; };
class B : A { void a(); };
void B::a() {}
otherwise
class A     { int a; };
class B : A { void a() {} };
is fine. What's the difference?
 

MT5 1159. Horizontal scale mismatch if medium or large font is set in "personalisation". Win7, 32b

 

How does MT5 autoscale the indicators in a separate window?

Indicator in a separate window

The terminal makes the maximum of 0.5603, while the actual maximum value of any indicator buffer on the entire history is 0.0605. Needless to say, there are no such problems in MT4.

 
Ilya Malev:

How does MT5 autoscale the indicators in a separate window?


The terminal makes the maximum of 0.5603, while the actual maximum value of any indicator buffer on the entire history is 0.0605. Needless to say, there are no such problems in MT4.

Check the values you have in the indicator buffer. You can do it manually with "Crosshair", you can do it with MQL5.
 
Karputov Vladimir:
Check the values you have in the indicator buffer. You can do it manually with "Crosshair", you can do it with MQL5.

I told you the maximum on the whole history is 0.0605. Checked in OnCalculate by comparing the maximum value of each buffer on each bar.

P.S. I actually already figured out what the issue is. Different algorithm for calculating the maxima in MT4 and MT5. I would like to understand the reasonability of changing this algorithm but it is a rhetorical question.

The problem was in MT4 - indicator buffer values displayed in the data window affect the scale of a separate indicator window, even if their display on the chart is disabled (DRAW_NONE style). I solved the problem by making them negative and fixing the minimum at 0. Everything was displayed perfectly, because only indicator values above the fixed minimum (0) participated in the scale calculation. Now values below the fixed minimum participate in the scale calculation. In other words, they have not added the ability to remove the buffer values from the scale calculation (or I have not figured it out yet), but they have removed the ability to exclude them from the scaling by putting them below the minimum or maximum. (this all applies to DRAW_NONE buffers not displayed)

 
Ilya Malev:

I told you the maximum on the whole history is 0.0605. Checked in OnCalculate by comparing the maximum value of each buffer on each bar.

P.S. I actually already figured out what the issue is. Different algorithm for calculating the maxima in MT4 and MT5. I would like to understand the reasonability of changing this algorithm but it is a rhetorical question.

Whatever values are passed to the indicator buffer, they will be the same. Another variant: at the beginning of the start you don't analyze each element of the indicator buffer and get random values in the buffer as a result.

So, you can't do without looking at the code.

 
Karputov Vladimir:

Another option: at the beginning of the start you don't count every element of the indicator buffer and end up with random values in the buffer.

I already figured it out. By the way, it was also an unexpected surprise of MT5 :)
 
Karputov Vladimir:

Anyway, you can't do without looking at the code here.

OK, here's the code

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots 2
#property indicator_minimum 0
#property  indicator_color1 clrRed
#property  indicator_type1 DRAW_LINE
#property  indicator_label1 "Стд.Откл."

double buffer1[], buffer2[];

int i_std=INVALID_HANDLE;

void OnInit(){
   SetIndexBuffer(0, buffer1);
   SetIndexBuffer(1, buffer2);
   PlotIndexSetInteger(1, PLOT_DRAW_TYPE, DRAW_NONE);
   PlotIndexSetInteger(1, PLOT_SHOW_DATA, true);
   ArraySetAsSeries(buffer1, true);
   ArraySetAsSeries(buffer2, true);
   i_std=iStdDev(Symbol(), Period(), 20, 0, MODE_SMA, PRICE_CLOSE);
}

void OnDeinit(const int reason){
   if(i_std!=INVALID_HANDLE)  IndicatorRelease(i_std);
}

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[]){

   for(int i=rates_total-MathMax(1, prev_calculated); i>=0; i--){
      buffer1[i]=_ind(i_std, 0, i);
      buffer2[i]=-MathRand()%5;
   }
   return(rates_total);
}

double _ind(int hnd, int buf, int index){
   if(index < 0) return(EMPTY_VALUE);
   double Arr[];
   return(CopyBuffer(hnd, buf, index, 1, Arr)==1?Arr[0]:EMPTY_VALUE);
}
 

I don't know if it is a bug or strange behaviour but in the MT4 strategy tester buffers for indicators have size of about 1000 +/- 3 cells.

With other types of testing - demo or real - the number of cells in the buffer is about the same as the number of bars allowed in the terminal settings.

I want to ask if it's a bug or it was supposed to be like that, I also noticed that indicators can be edited while testing without stopping the tester. I have not read any info anywhere on the Expert Advisors yet, but thanks for that !