Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 851

 
from which bar does the indicator process the values at start (and how can it be changed)? can all but the 0th be counted in the init?
 
mitanq:

Put ontick instead of time[0] ?
I haven't seen the EA code and I don't know how the new bar control is implemented there.
 
eddy:
from which bar does the indicator process the values at the start (and how do I change it)? can all but the 0th be counted in the init?
Almost every indicator has a calculation cycle, which goes through the specified number of bars from X to Y, in some cases in ascending order, in some cases vice versa. So, in this cycle it is set which bar to start from.
 
http://www.admiralmarkets.com.ua/media/Image/MQLabs/39_ag/Complex_Expert_V2.mq4
evillive:
I have not seen the code of the EA and I don't know how it is implemented to control a new bar.

link to the advisor. The EA is great, by the way.

http://www.admiralmarkets.com.ua/media/Image/MQLabs/39_ag/Complex_Expert_V2.mq4

And a link to attached indicators.

http://www.admiralmarkets.com.ua/media/Image/MQLabs/39_ag/indicators.zip


The CrossMA indicator.


The code is very simple and everything is described.


But I can't make it trade on every tick.


Maybe it is in the indicator?


It has such a line:


// - 3 - ======================= Signals output ========================================
if (LastBar != Time[0])// Once per bar
{

 

Guys, a question about the tester. Is it possible to more smoothly adjust the speed of EA testing in visualisation mode via the EA itself? Thank you in advance.

Maybe there is a function that can be prescribed.

 
mitanq:

// - 3 - ======================= Signal output ========================================
if (LastBar != Time[0])// Once per bar
{

...

}

Yes, these lines should be commented out and the behaviour of the EA on ticks should be checked.

And in the indicator too

// - 3 - ======================= Выдача сигналов ======================================== 
   if (LastBar != Time[0])                                        // Один раз за один бар
     { 
      if (FastMA[1] > SlowMA[1])
        GlobalVariableSet(Signal, 1);
       else 
        if (FastMA[1] < SlowMA[1])
          GlobalVariableSet(Signal, -1);                                          // Sell
         else
          GlobalVariableSet(Signal, 0);                                    // Нет сигнала
      GlobalVariableSet(STime, Time[0]);                   // Время последнего обновления
      LastBar = Time[0];     
     }   
// - 3 - ============================ Окончание блока ===================================
    
 
evillive:

Yes, these lines should be commented out and the behaviour of the EA on ticks should be checked.

And in the indicator too


Tried it. No way.
 
mitanq:

Tried it. No way.
So you have to correct all the indicators there, not just Crosma.
 
evillive:
So in all indicators you need to correct, not only in cross.

I only use cross. To understand. Then in the others, if I get it right.

I tried everything. It still opens on the next candle (

 
How do I find the maximum value of High[] among several bars?