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

 
Igor Zakharov:

How would I know? The person who asked the question used iLow(), so he needs it. Maybe it's simpler, maybe he plans to refer to another symbol or timeframe through an input variable (can't remember if there are copyrates in quadruple?)

There is.

 
psyman:

I didn't post the code here, but wrote the simplest one to simplify the parse.

Tell me more about what's wrong, it's not clear about maximum speed.

Vladimir Karputov:

The code is GREATLY GLUCKY - because on every tick there is a pass over ALL BARs.


In fourth it wasIndicatorCounted(), I don't know what possibilities there are in fifth, and there's nowhere even to read about it.

Is this option good, or can it be simplified?

int OnCalculate(....)
{
   int i, Counted_bars;
   
      Counted_bars=IndicatorCounted(); // Количество просчитанных баров 
      i=Bars-Counted_bars-1;           // Индекс первого непосчитанного

      while(i>=0)                      // Цикл по непосчитанным барам
      { 
        .....
        
       i--;                          
      }
}

int IndicatorCounted()
  {
   if(prev_calculated>0) return(prev_calculated-1);
   if(prev_calculated==0) return(0);
   return(0);
  }
 
psyman:


In Q4 there wasIndicatorCounted(), I don't know what possibilities there are in 5 and there's nowhere to read about it.

Is this option good, or can it be simplified?

Help, forum, articles - is this the "nowhere to read" in your opinion? If only you had the desire. In fact, you're writing in the subject of the old terminal, while your question is about MQL5. I have missed the point.

I have left the topic.

 
psyman:


In Q4 there wasIndicatorCounted(), I don't know what possibilities there are in 5 and there's nowhere to read about it.

Is this option good or can it be simplified?

Now both in mql4 and mql5 the main indicator function has everything you need

int OnCalculate (const int rates_total,      // размер входных таймсерий
                 const int prev_calculated,  // обработано баров на предыдущем вызове
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[]         // Spread
   );

prev_calculated is the number of calculated bars.

 

Hello.

If the price has changed by 30 pips in 60 seconds, I will mark the bar

 for(int i=limit; i>=0; i--)
     {
      datetime t_=TimeCurrent();
      if(t_>t_b+60)
        {
         t_b = TimeCurrent();
         pr_b=close[0];
        }
      if(MathAbs(close[0]-pr_b)>=30*Point && t_<t_b+60)
        {
         BufferUP[i]=low[i]-10*Point;
        }

     }

What's wrong?

 
lil_lil:

Hello.

If the price has changed by 30 pips in 60 seconds, I will mark the bar

What's wrong?

Why is it like this

int limit=rates_total-prev_calculated-1;

and not like this?

int limit=rates_total-prev_calculated;

Where do I set the limit?

   if(limit>1)
     {
      ArrayInitialize(BufferUP,EMPTY_VALUE);
      ArrayInitialize(BufferDN,EMPTY_VALUE);
     }
   if(limit>1)
     {
      limit=rates_total-1;
      ArrayInitialize(BufferUP,EMPTY_VALUE);
      ArrayInitialize(BufferDN,EMPTY_VALUE);
     }

Didn't look any further

 
Artyom Trishkin:

Why is it like this

and not like this?

Where is the limit setting?

I didn't look any further.

Thank you, but there's no result that way either. Look further, please.

 
lil_lil:

Thank you, but there's no result that way either. Look further, please.

What's that?

datetime t_=TimeCurrent();

What time do you take in the loop? What is TimeCurrent()?

 
Hello!
There is a function in the Expert Advisor to get text from a link.... I get it with this library:
https://github.com/sergeylukin/mql4-http
Everything is fine and there are no questions about it!
The problem is as follows:
In this link the text is systematically updated and the terminal does not perceive it, even when you reset the owl from the chart and put it back! Only closing and opening the terminal at all helps! Maybe who knows how to fix it?
 
lil_lil:

Hello.

If the price has changed by 30 pips in 60 seconds, I will mark the bar

What's wrong?

I recently came across a freelance order with a similar task. Isn't that the job you're doing?