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

 
rapid_minus:
Thank you... What a country of the Soviets! Unfortunately, I'm not really burning with the desire to thoroughly study MQL4. At this stage it is of narrow applied interest, i.e. purely for one particular Expert Advisor. I know I don't need a manual, but I want professionals to help me, even absentee tutors are available. Well, we will do it ourselves. But it's a pity about the time.

Qualified help for a reasonable fee: https://www.mql5.com/ru/job Don't neglect and save time! In this world they pay for advice too!

Everything is commercialized!

 
borilunad:

Qualified help for a reasonable fee: https://www.mql5.com/ru/job Don't neglect and save time! In this world they pay for advice too!

Everything is commercialised!

The only dinosaur left is Igor Kim. And he, in my opinion, has got tired of us ignoramuses. It is a pity...
 
rapid_minus:
The only dinosaur left is probably Igor Kim. And I think he got tired of us amateurs. It's a pity...
Why? There's still some...
 
artmedia70:
Why, there's a little more...

Yes, thank you. I also know you from Kim's thread. In recent years the branch has become heavily littered, unfortunately (IMHO).

I dare not address the respected and even revered directly (yet...), but: "A" has already been said...

 

Hello,

Seems to be fine, but it won't show low[1] .


//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
int high[7],low[7],timeh[7],timel[7];
//+------------------------------------------------------------------+
int init(){  
  return(0);
 }
int deinit(){
  Comment("");
  return(0);
 }  
//-------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
int start(){
    double   spred = MarketInfo(Symbol(),MODE_SPREAD);
    int      value0,value1,value2,limit,av_vol;
    int      i,Open_bar_per,Close_bar_per;
    datetime Time_period,Close_per;
//+------------------------------------------------------------------+
       Time_period   = iTime(Symbol(),PERIOD_D1,0);
       Open_bar_per  = iBarShift(Symbol(),0,Time_period,false);
       Close_per     = iTime(Symbol(),0,0)-Period()*60;
       Close_bar_per = iBarShift(Symbol(),0,Close_per,false);
       limit         = Open_bar_per - Close_bar_per;

   for(i=limit;i>0;i--){
       value0=0;value1=0;value2=0;

       value0   = iVolume(Symbol(),0,i);
       value1   = iVolume(Symbol(),0,i+1);
       value2   = iVolume(Symbol(),0,i+2);
       
    if(value0 > value1 && value1 < value2){
       low[0]   = value1;
       timel[0] = iTime(Symbol(),0,i+1);
     }
    if(value0 < value1 && value1 > value2){
       high[0]  = value1;
       timeh[0] = iTime(Symbol(),0,i+1);
     }
   for(int j=7;j>=0;j--){
       high[j]  = high[j-1];
       low[j]   = low[j-1];
       timeh[j] = timeh[j-1];
       timel[j] = timel[j-1];
     }
    if(high[1] < high[2]){
       high[1]  = high[2];
       timeh[1] = timeh[2];
     }
    if(low[1] > low[2]){
       low[1]   = low[2];
       timel[1] = timel[2];
     }
  } 
       av_vol = NormalizeDouble(high[1]/3,0);
//+------------------------------------------------------------------+
     Comment("\nВреме на брокера: ",TimeToStr(TimeCurrent(),TIME_SECONDS),", Локално време: "+TimeToStr(TimeLocal(),TIME_SECONDS),
             "\nТекущ спред: ",DoubleToStr(spred/10,1),
             "\n=====================",
             "\n High_per  :  ",high[1],
             "\n Low_per   :  ",low[1],   
             "\n time_high :  ",TimeToStr(timeh[1],TIME_SECONDS),
             "\n time_low  :  ",TimeToStr(timel[1],TIME_SECONDS),
             "\n Close_per :  ",TimeToStr(Close_per,TIME_SECONDS),
             "\n Open_per  :  ",limit, 
             "\n=====================",
             "\n av_vol    :  ",av_vol,
             "\n====================="
             ); 
  return(0);  
  }
 
mario065:

Hello,

It seems to be ok, but it won't show low[1] .



Doesn't it confuse you if it's outside the array?

It's right here:

for(int j=7;j>=0;j--){
       high[j]  = high[j-1];
       low[j]   = low[j-1];
       timeh[j] = timeh[j-1];
       timel[j] = timel[j-1];
     }

Besides, "doesn't want to show" there everything, not just low[1].

 
evillive:

Not confused by going outside the array?

Right there:

I don't get it!?

This loop is only for moving the result.

Then if there's a condition, it'll be the first one again.

 
mario065:

I don't get it!?

This loop is only for moving the result.

Then if the condition is again it will be the first

The loop accesses non-existent array elements, no matter what it's used for. That's not good.
 
evillive:
A loop accesses non-existent array elements, no matter what it's for. This is not good.
Suggestions-how to fix it?
 
evillive:

Not confused by going outside the array?

Right here:

Also, "doesn't want to show" everything there, not just low[1].

1
Reason: