Copy Multiple Buffers to Candle Zero for use in EA

 

my scanner is looking for 200 bars on chart and filtering values of high on specific candles

e.g. from candle 0 to candle 200 it may have values in bar 50 and bar 100 

on rest candles value can be zero

How can i pass these values to candle zero

so my scanner reads it at last candle

on my indicator : 

double UP[];
int OnInit() {

   SetIndexBuffer(0,UP,INDICATOR_DATA);
   ArrayResize(UP,200);
   ArraySetAsSeries(UP,true);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]) {
//---
ArraySetAsSeries(high,true);

for(int l=200; l>=0; l--) {
if(high[l]>18200.00)
Up[l]=high[l];
}else 
Up[l]=0.0;
}
}

On my EA: 

I want to check the valid values without using for loop , so please help me regarding how to pass values to EA using Copybuffer

If i use 

double vUp; 
CopyBuffer(handle,0,0,1,vUp);

then it will only get value of last 1 candle

but i want to get values of last 200 bar without using for loop

Documentation on MQL5: Integration / MetaTrader for Python / order_calc_margin
Documentation on MQL5: Integration / MetaTrader for Python / order_calc_margin
  • www.mql5.com
order_calc_margin - MetaTrader for Python - Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Simply place the cursor on CopyBuffer() and press F1 and you find all you need :)
 
Carl Schreiber #:
Simply place the cursor on CopyBuffer() and press F1 and you find all you need :)
I understand it but I think you did not read my question
I want to put all multiple values to candle 1 on indicator so I can access it using copybuffer without for loop with using code i posted above


 
You could, every time the indicator stores a zero, just copy the value of the former candle.

This way you would not have to loop the buffers.


 
Dominik Christian Egert #:
You could, every time the indicator stores a zero, just copy the value of the former candle.

This way you would not have to loop the buffers.


how to copy it using ArracyCopy function?

 
Arpit T #: how to copy it using ArracyCopy function?

Take some to this think this over.

The value at shift 0 is but a single element of the array. You can't copy multiple array elements into a single one.

All you can do is save a single resulting value at shift 0.

 
This is what I meant.

for(int l=200; l>=0; l--) {
if(high[l]>18200.00)
Up[l]=high[l];
}else 
Up[l]=Up[l + (l < 200)];
}
 
Dominik Christian Egert #:
This is what I meant.

looks interesting, i will try that and see the result

Reason: