Errors, bugs, questions - page 32

 
Now I've got a glitch too ... Until you recompile, the last bars are rendered.
 
Interesting:

The only correct way to do this is very simple.

You write a 100% working indicator, and it is done classically without the "Symbol" parameter, i.e. it is calculated using the current symbol and period.

After that such BASIC calculator is called in Expert Advisor (if mechanical work is provided) or calculator (if you need to display information on graph of NON-CALCULATING INSTRUMENT).

PS

Otherwise, if the calculator or a separate function has to do an additional calculation, and then link the results to the current graph data...

Suggestion worthy of consideration,

But of course from the point of view of common logic it is like scratching your left ear with right hand (but it's not for you, it's for developers),

Why do I need to call the data of a non-native instrument?

If you have to create custom indicators and call them from a required symbol anyway, in general, the conclusion is that I'll buy it.

But again, I call a ready indicator for EUR with data on JPY (for example, there's not enough history for the Yen)

If I look for the same indicator, it will give me the same signal.

Переход на новые рельсы: пользовательские индикаторы в MQL5
Переход на новые рельсы: пользовательские индикаторы в MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
Я не буду перечислять все новые возможности и особенности нового терминала и языка. Их действительно много, и некоторые новинки вполне достойны освещения в отдельной статье. Вы не увидите здесь кода, написанного по принципам объектно-ориентированного программирования — это слишком серьезная тема для того, чтобы просто быть упомянутой в контексте как дополнительная вкусность для кодописателей. В этой статье остановимся подробней на индикаторах, их строении, отображении, видах, а также особенностях их написания по сравнению с MQL4.
 

Here's a workable option:

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
//--- plot LRma
#property indicator_label1  "LRma"
#property indicator_type1   DRAW_LINE
#property indicator_color1  Red
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
input string             symbol      ="EURJPY";
input int                MA_Period   =25;          // период MA
input int                MA_shift    =0;           // сдвиг индикатора
input ENUM_APPLIED_PRICE price       =PRICE_OPEN;  // тип цены 
//--- indicator buffers
double  LRma[],L[],S[],iPoint,iiMA;

int Lwma,Sma;// Хендлы машек
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,LRma,INDICATOR_DATA);
   Lwma=iMA(symbol,0,MA_Period+1,MA_shift,MODE_LWMA,price);
   Sma=iMA(symbol,0,MA_Period+1,MA_shift,MODE_SMA,price);
   iPoint=1.0/SymbolInfoDouble(symbol,SYMBOL_POINT);
   iiMA=1.0/MA_Period;
   IndicatorSetString(INDICATOR_SHORTNAME,"LRma_symbol_"+symbol);
//---
   int count=(int)SeriesInfoInteger(symbol,0,SERIES_BARS_COUNT);
   while(BarsCalculated(Lwma)<count){}
   while(BarsCalculated(Sma)<count){}
   ArraySetAsSeries(L,true);
   ArraySetAsSeries(S,true);
   ArraySetAsSeries(LRma,true);
   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 count=rates_total-prev_calculated;
   if(count>1)count=(int)SeriesInfoInteger(symbol,0,SERIES_BARS_COUNT);
   if(count==0)count=1;
   while(BarsCalculated(Lwma)<count){}
   while(BarsCalculated(Sma)<count){}
   if(CopyBuffer(Lwma,0,0,count,L)!=-1)
     {
      if(CopyBuffer(Sma,0,0,count,S)!=-1)
        {
         for(int i=0;i<MathMin(ArraySize(LRma),ArraySize(L));i++)
            LRma[i]=(L[i]-S[i])*6*iPoint*iiMA;
        }
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 

I can add another headache. If the indicator is on one chart, but is from another, you have to take into account that the number of bars may be different:

  1. That the number of bars may be different. I think has already been taken into account.
  2. Take into account that there may be gaps in the history for the instrument, and 25 bars in the history for one instrument, it may be Monday, and for another one - Friday...
  3. even if you have solved the first two problems, there is still synchronization in time, for one instrument a new bar has already started, for another one it has not yet started ...
  4. the indicator works only with the arrival of a new tick, i.e. if it hangs on the chart with few ticks, the 0 bar of another chart is problematic...
  5. if you quit counting the 0 bars, only the completed ones, then there will be a couple more pitfalls...
Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
  • www.mql5.com
Доступ к таймсериям и индикаторам / Bars - Документация по MQL5
 
Prival:

I can add another headache. If the indicator is on one chart, but shows from another one, you have to take it into account:

  1. That the number of bars may be different. I think we have already taken this into account.
  2. Take into account that there may be gaps in the history for the instrument, and 25 bars in the history for one instrument, it may be Monday, and for another one - Friday...
  3. even if you have solved the first two problems, there is still synchronization by time, for one instrument a new bar has already started, for another has not yet started ...
  4. the indicator works only with the arrival of a new tick, i.e., if it hangs on a chart with few ticks, it will be problematic for the 0 bar of the other chart...
  5. If you stop counting 0 bars, only completed ones, then there will be a couple more pitfalls...

Thanks for the kind words :o)
 

Bug. Description. ATS always in market (rollover by double lot 0.2).

Test mode all ticks. Everything is normal.

Testing mode, by opening prices. the same piece.

For some reason it splits into 2 trades. maybe it's just the way it is displayed, but it's not right. it shouldn't be that way.

 
Alexandr2385:

Hello, I have a serious problem with the MT5 terminal. When I start the terminal, only the price line (bid) is moving, while the candlesticks (bars) are not drawing/changing. Hence, the price moves without changing the chart. I have a question: How can this problem be solved? In fact, everything is working fine in MT4! I tried to reinstall the terminal, but it didn't help! I had such a problem with several brokers... Can you tell me what to do in this situation?
Does anybody from the developers can answer the question? Or should I ask it in another thread?
Files:
1.png  31 kb
 
Alexandr2385:
Can any of the developers answer the question? Or should I ask it in another thread?
+1 I've seen the same thing, but it seems to be working properly now, they must have fixed it
 
SHOOTER777:

+1 I've seen the same thing, but it seems to be working properly now, they must have fixed it

Yeah strangely enough, but it's just gone now, don't know for how long...

 
Prival:

I can add another headache. If the indicator is on one chart, but shows from another one, you have to take it into account:

  1. That the number of bars may be different. I think we have already taken this into account.
  2. Take into account that there may be gaps in the history for the instrument, and 25 bars in the history for one instrument, it may be Monday, and for another one - Friday...
  3. even if you have solved the first two problems, there is still synchronization by time, for one instrument a new bar has already started, for another has not yet started ...
  4. the indicator works only with the arrival of a new tick, i.e., if it hangs on a chart with few ticks, it will be problematic for the 0 bar of another chart...
  5. If you stop counting 0 bars, the hell with it, only the completed ones, then there will be a couple more pitfalls...

I agree about the holes and history problems.

With normal operation and period synchronisation, the new bars should (logically) start at the same time...

Reason: