Errors, bugs, questions - page 525

 

Good afternoon, is it possible to change the standard graphical tool in any way? More specifically: add a vertical line to the Fibo grid, plotted at a factor of 1.3

 

a question about the use of indicators. I wrote a test code.

int Fractals;
double bar_val[];
bool start;
int OnInit()
{
   Fractals = iFractals(_Symbol, _Period);
   if (Fractals == INVALID_HANDLE) return (1);
   if (!ArrayResize(bar_val, 2)) return (1);
   if (!ArraySetAsSeries(bar_val, true)) return (1);
   start = false;
   return(0);
}

void OnTick()
{
   if (start) return; else start = true;
   for (int i = 0; i < 10; i++)
   {
      CopyBuffer(Fractals, UPPER_LINE, i, 2, bar_val);
      if (EMPTY_VALUE != bar_val[0])
         Print("1. i = " + string(i) + ", bar_val = " + string(bar_val[0]));
      CopyBuffer(Fractals, LOWER_LINE, i, 2, bar_val);
      if (EMPTY_VALUE != bar_val[0])
         Print("2. i = " + string(i) + ", bar_val = " + string(bar_val[0]));
   }
}

It periodically displays fractal with i = 2, but it is not present on the screen (from the standard indicator Fractals)

Please advise what is the error

 
For some reason, between 2001 and 2006 no experts are being tested. I looked at the euro and the pound. Closed the terminal, deleted the history. Downloaded it again. All the same. It is possible to open deals till 2001. And from 2001 to 2006 it skips when there are signals. Why?
 

The timeframe buttons on the terminal bar are stuck. Sometimes several of them at once when frequently switching from one TF to another. Perhaps, it is due to a large number of windows, indicators, templates... However, I used to have as many windows as I did but this effect was not observed. The screenshot is an example of inconsistency between the timeframe button pressed and the real value shown in the upper left corner of the chart. More of a long term effect, although it does come off sooner or later.

Sometimes none is pressed at all.

 

Can I control the size of the window using mql5?

 
ilunga:

a question about the use of indicators. I wrote a test code.

It periodically displays fractal with i = 2, but it is not present on the screen (from the standard indicator Fractals)

Please advise what the error is

You should not know the exact code of the Expert Advisor at a glance
 
tol64:
For some reason, between 2001 and 2006 no experts are being tested. I looked at the euro and the pound. Closed the terminal, deleted the history. Downloaded it again. All the same. It is possible to open deals till 2001. And from 2001 to 2006 it skips when there are signals. Why?
Additional information. This only happens if you selected D1 timeframe in the tester settings. If I select timeframe D1 in the Expert Advisor's settings and a smaller TF in the tester's settings, then there will be no skipping. Is this a bug or is there some explanation?
 

I made a simple indicator, but I don't understand why it doesn't want to work;(

//+------------------------------------------------------------------+
//|                                                      testind.mq5 |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots   1
//--- plot Vol
#property indicator_label1  "UniPrice"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrLightSlateGray
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
#include <MovingAverages.mqh>
//--- input parameters
input int      Smooth=50;
//--- indicator buffers
double         SmoothSpreadBuffer[];
double         SpreadBuffer[];
double         UniPriceBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,UniPriceBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,SpreadBuffer,INDICATOR_CALCULATIONS);
   SetIndexBuffer(2,SmoothSpreadBuffer,INDICATOR_CALCULATIONS);
   
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| 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[])
  {
//---
   int i;
   for(i=1;i<rates_total;i++)
     {
      SpreadBuffer[i]=(high[i]-low[i]);
     }  
     
   SmoothedMAOnBuffer(rates_total,prev_calculated,
                         1,  // с какого индекса есть значения в массиве для сглаживания 
                         Smooth,  // период экспроненциальной средней
                         SpreadBuffer,       // буфер для взятия средней
                         SmoothSpreadBuffer);  // в этот буфер помещаем значения средней      
   for(i=1;i<rates_total;i++)
     {
      UniPriceBuffer[i]=close[i]/SmoothSpreadBuffer[i];//не показывает
      //UniPriceBuffer[i]=close[i]/SmoothSpreadBuffer[rates_total-1];//показывает
      //UniPriceBuffer[i]=close[i];//показывает
      //UniPriceBuffer[i]=SmoothSpreadBuffer[i];//показывает
     }  
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

Why does it not want to divide one by the other and show the result?

Sometimes it gives a result, but it doesn't correspond to reality, for example EURUSD should have a value within 300-400 on the clock...

 
Olegts:

I made a simple indicator, but I don't understand why it doesn't want to work;(

close[i] when I substitute it, SmoothSpreadBuffer[i] when I substitute it, why does it not want to divide one by the other and show the result?

It's true, sometimes it gives a result, but it doesn't correspond to reality, for example, EURUSD clock should have a value in the range of 300-400...

UniPriceBuffer[i]=close[i]/SmoothSpreadBuffer[i];

Just substitute EURUSD values here for the current time and you'll get it:

Ma for example with an average of 16 at closing prices

UniPriceBuffer[i] = 1,33846 / 1.33932 = 0,99935

or better to use

handle=iMA(name,period,ma_period,ma_shift,ma_method,applied_price);
и т.д
 

After the last build, the terminal hangs on loading. There is no access to the menu or the context menu. No access to menu or context menu. WIn7. Symbols overview window is empty. Connection icon is red. No CPU load. What to do and when will stability be available?

Описание:
  Ошибка привела к остановке взаимодействия программы с Windows.

Сигнатура проблемы:
  Имя события проблемы:    AppHangB1
  Имя приложения:    terminal.exe
  Версия приложения:    5.0.0.514
  Отметка времени приложения:    00343800
  Сигнатура зависания:    86b5
  Тип зависания:    1
  Версия ОС:    6.1.7601.2.1.0.256.1
  Код языка:    1049
  Доп. сигнатура зависания 1:    86b56845a796dcc49c1ed94bca152915
  Доп. сигнатура зависания 2:    4dea
  Доп. сигнатура зависания 3:    4dea45bbcdd37e9fd7bef8af1f8c0d94
  Доп. сигнатура зависания 4:    1df5
  Доп. сигнатура зависания 5:    1df5990b738955081f33bb6a466caece
  Доп. сигнатура зависания 6:    b4e6
  Доп. сигнатура зависания 7:    b4e6e85bfba9e3852328760498392cb4

Reason: