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

 

As far as I remember, one of the terminal upgrades added the possibility to automatically load quotes into a user tool,

as if they came from a broker.

What's up? Please send me the manual.

thanks

 
barashka:

As far as I remember, one of the terminal upgrades added the possibility to automatically load quotes into a user tool,

as if they came from a broker.

What's up? Please send me the manual.

Thank you

If you would be so kind as to use the search engine.

I've got my doubts... (с)

 
Artyom Trishkin:

Is this suitable for MT4?

 
Evgeny Potapov:

Is this suitable for MT4?

What exactly is "it"?

 
Artyom Trishkin:

What exactly is "it"?

I'm looking for some class or example of scrollbar organization in MQL4, not in MQL5

 
Evgeny Potapov:

I'm looking for some class or example of scrollbar organization in MQL4, not in MQL5

In 90% of cases the codes between MQL4 and MQL5 are compatible, the main difference is in trading operations and working with strategy tester

99% compatible in the graphical part - there was a small difference in the standard library, or maybe the developers have already fixed it.

 
Igor Makanu:

In 90% of cases codes between MQL4 and MQL5 are compatible, the main difference is in trading operations and working with the strategy tester.

99% compatible in the graphical part - there was a small difference in the standard library, maybe the developers have already fixed it.

I'm getting an error:

testscrollbar EURUSD,M1: indicator on custom buffer is not supported yet
I would like to see a working code (in MT4) and deal with it.
 
Evgeny Potapov:

I'm getting an error:

I would like to see a working code (in MT4), and deal with it.

search the forum - I won't search

here's something similar not long ago helped to sort outhttps://www.mql5.com/ru/forum/320293/page3#comment_12887682

 
Igor Makanu:

search the forum - I won't search

here's something similar not long ago helped to sort outhttps://www.mql5.com/ru/forum/320293/page3#comment_12887682

Thank you! It works! This is great!

And the slider shift event handling functions are present!

Can you suggest how to expand the scroll bar vertically?

 

Why is sometimes the null buffer element displayed incorrectly?

Code:

int Limit = rates_total - prev_calculated; 
       if (prev_calculated > 0)
         Limit++;
       if(prev_calculated==0) Limit--;
         
         for(int i=Limit; i>-1; i--){
         
            if (startTime!=isTime(i)){
                  startTime=isTime(i);
                  startPriceCur=Open[iBarShift(NULL, NULL,startTime,false)];
                 
                             Comment("time: ", isTime(i));
            }
            
            if(Close[i]>startPriceCur)
            CurrentCurrencyBuffer[i]=100-(100*startPriceCur/Close[i]);
            if(Close[i]<startPriceCur)
            CurrentCurrencyBuffer[i]=(Close[i]*100/startPriceCur)-100;
            if(Close[i]==startPriceCur)
            CurrentCurrencyBuffer[i]=0;
            
         }

I added a limiter, according to which the algorithm calculates only once, when a new bar appears. With this approach it displays correctly:

if(controller<Bars){
 
       int Limit = rates_total - prev_calculated; 
       if (prev_calculated > 0)
         Limit++;
       if(prev_calculated==0) Limit--;
        
         for(int i=Limit; i>-1; i--){
         
            if (startTime!=isTime(i)){
                  startTime=isTime(i);
                  startPriceCur=Open[iBarShift(NULL, NULL,startTime,false)];
                 
                             Comment("time: ", isTime(i));
            }
            
            if(Close[i]>startPriceCur)
            CurrentCurrencyBuffer[i]=100-(100*startPriceCur/Close[i]);
            if(Close[i]<startPriceCur)
            CurrentCurrencyBuffer[i]=(Close[i]*100/startPriceCur)-100;
            if(Close[i]==startPriceCur)
            CurrentCurrencyBuffer[i]=0;
            
         }
        controller=Bars;
}


But this algorithm calculates zero bar only at opening. I would like it to be counted all the time (and correctly). How can this be fixed?

Reason: