Proportioning 2 or more buffers with different homogeneous size, in the same window

 

As you read in subject, I need to proportioning 2 buffers with different homogenous size,i n the same subwindow.

ex.

BufferOne[0] = 1.10 ;
BufferOne[1] = 1.15 ;
BufferOne[2] = 1.22 ;
BufferOne[3] = 1.50 ;
BufferOne[4] = 1.30 ;

BufferTwo[0] = 100 ;
BufferTwo[1] = 150 ; 
BufferTwo[2] = 350 ;
BufferTwo[3] = 55  ;
BufferTwo[4] = 782 ;


I've setted as default

#property indicator_minimum   0
#property indicator_maximum   1000

So I didn't found how put all in proportion, as you can understand, BufferOne appears flat respect to BufferTwo;

Could be happen that BufferOne' values exceed to 1000, so I must put in proportion both buffers;

 
Mql4 windows have ONE scale. Either two windows or scale one set.
 
WHRoeder:
Mql4 windows have ONE scale. Either two windows or scale one set.

That's the trick I'm searching for! :-)

I don't know how scale them!

Thanks for Reply

 
#define WINDOW_HI 1000
#define WINDOW_LO    0
#define INDI_HI      2
#define INDI_LO      0
double valueScaled = (value - INDI_LO) / (INDI_HI - INDI_LO) * (WINDOW_HI - WINDOW_LO) + WINDOW_LO;
 

It seems to works, let me fix the code.

The only issue, could be up scrolling the chart backwards and forward, the window doesn't resize itself according with the max value of the buffers;

so we could have flat graph in some cases;

Many Thanks


 
nowhere:
The only issue, could be up scrolling the chart backwards and forward, the window doesn't resize itself according with the max value of the buffers;
Then min/max isn't fixed. Find the begin/end of the chart and compute the indicators min/max in that range.
int     iVisible    =           WindowFirstVisibleBar(),
        iVisEnd     = MathMaxI( iVisible-WindowBarsPerChart(),0),// Chart shift
        length      = iVisible - iVisEnd +1;
double  indiMax     = ArrayMaximum(buffer,length,iVisEnd);
:
int     MathMaxI(int a, int b){
                        if(a>b) return(a);              return(b);             }
 

I suppose this solution works just on new ticks, waiting for Monday;

Hope in mt5 we could have something like SCROLL_EVENT;


Thanks

 
nowhere:

I suppose this solution works just on new ticks, waiting for Monday;

Why don't you use the Strategy Tester ?
 
Never used lung.
RaptorUK:
Why don't you use the Strategy Tester ?

Never used.
 
Why not learn . . . then you could have tested your code over a day ago . . .
 
I've others code to test, so if I delay the test of this code don't waste time anyway, but I take in mind, thanks
Reason: