Additional buffer

Hi guys

coming from MT4 I’m trying to implement some code in mql5.

A) an additional buffer is to be added to an already existing indicator with 3 buffers, to transmit a (buy, sell) condition to an EA.

Now in MT4 it works, when changing #property indicator_buffers from 3 to 4, then adding to

 SetIndexBuffer(0,Abuffer,INDICATOR_DATA);
 SetIndexBuffer(1,BBufffer,INDICATOR_DATA); 
 SetIndexBuffer(2,CBuffer,INDICATOR_DATA);
 SetIndexBuffer(3,NewBuffer,INDICATOR_DATA); // double NewBuffer[] is already defined, btw

In this Indicator - for the BuyCondition - the NewBuffer[0] is simply set to 1 ---- SellCondition set to -1

When addressing this indicator in an EA the “old” buffer-values(0,1,2) show up correctly using the Comment function.

When using CopyBuffer(HandleBuffer,0,0,2,BufferToImport);
ArraySetAsSeries(BufferToImport,true); etc. but in the case of CopyBuffer(HandleBuffer,3,0,2,BufferToImport) there appears just a very large number (looks like kinda overflow)

B) Does anyone know how to limit the number of bars, which are shown in the window and above all which are used to calculate in an indicator?

I thought it would work by replacing at the beginning int OnCalculate(const int rates_total, … by a constant number

int OnCalculate(const int 100),…for example but it doesn’t work.

For any ideas thanks in advance

Cheers