Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1727

 
Ivan Butko #:

Thank you.

I wrote Print("Bar count on the 'EURUSD,M1' is ",iBars("EURUSD",PERIOD_M1));, taken from the documentation. I printed the number 1001 in the log.))) Although, the history is loaded, the max is more than 1000000 bars in the settings.

Please advise how to solve the problem

Download the story

2021.11.08 11:02:11.919 !Print_Magic EURUSD,M30: Bar count on the 'EURUSD,M1' is 73589
 
MakarFX #:
download the history.

Loaded, in full. Went into the archive, there are 8,000,000 minute bars
And the log says

EURUSD,M1: Bar count on the 'EURUSD,М1' is 1001


 
Ivan Butko #:

Loaded, in full. Went into the archive, there are 8,000,000 minute bars
And the log says

EURUSD,M1: Bar count on the 'EURUSD,М1' is 1001


 
Ivan Butko #:

Thank you.

I wrote Print("Bar count on the 'EURUSD,M1' is ",iBars("EURUSD",PERIOD_M1));, took it from the documentation. The terminal logged the number 1001.) Although, the history is loaded, the max is more than 1000000 bars in the settings.

Please advise how to solve the problem

in the tester always 1000 bars at start (or less).

 
MakarFX #
int n=10;
   datetime bar_sig;
   for(int i=n;i>=0;i--)
     {
      if(iCustom(NULL,0,"Твой индикатор",0,n)=="Сигнал")
         bar_sig=time[n];
     }

This code shows the signal on the 10th candle, but I need to check the signal on each candle from 1 to N.

 
Snajper007 #:

This code shows the signal on the 10th candle, but I need to check the signal on each candle from 1 to N.

No, this code checks 10 candlesticks and shows which one was the signal
 
MakarFX #:
No, this code checks 10 candlesticks and shows which one the signal was on
In practice it only shows when the signal candle becomes the 10th.
 
Snajper007 #:
In practice it only shows when the signal candle becomes the 10th.
Studio code
 
int n=10;
   datetime bar_sig_buy, bar_sig_sell;

   for(int i=n;i>=0;i--)
     {
     // для покупок
   double a1 = iCustom(NULL, 0, "FL11", 4, n);
   // для продаж 
   double a2 = iCustom(NULL, 0, "FL11", 5, n);


      if(a1 > 0)
         bar_sig_buy=Time[n];
         
      if(a2 > 0)
        bar_sig_sell = Time[n];
     Comment("bar_sig_sell = " + DoubleToString(bar_sig_sell)+ "\n" +
     "bar_sig_buy = " + DoubleToString(bar_sig_buy));

     }
 

MakarFX, here is a screenshot As soon as the signal candle became the 10th, the value was greater than zero. And before that it was equal to zero.