Download MetaTrader 5
To add comments, please log in or register
Publish your article and thousands of people all over the world will read it!
Jordi Bassaganas
3521
Jordi Bassaganas 2013.09.25 12:24 

Hi there,

I am using the function CopyBuffer inside OnCalculate this way:

if(CopyBuffer(DEMAHandler,0,0,rates_total,DEMABuffer)<=0) return(0);

I understand that the programming sentence above generates an array with the info of all the rates (MN, month). But is it possible to call CopyBuffer in order to fill DEMABuffer with as many elements as the total number of rates of a given time frame (H1, H4, etc.)? In other words, how can you ask for the number of rates of a given time frame? Thks a lot in advance! 

Alain Verleyen
Moderator
29606
Alain Verleyen 2013.09.25 12:56  
laplacianlab:

Hi there,

I am using the function CopyBuffer inside OnCalculate this way:

I understand that the programming sentence above generates an array with the info of all the rates (MN, month). But is it possible to call CopyBuffer in order to fill DEMABuffer with as many elements as the total number of rates of a given time frame (H1, H4, etc.)? In other words, how can you ask for the number of rates of a given time frame? Thks a lot in advance! 

You have to use an other handle for DEMA with requested Period as parameter.

Then you can use Bars() function. That gives something like :

int count = Bars(_Symbol, RequestedPeriod);
if(CopyBuffer(DEMAHandler_RequestedPeriod,0,0,count,DEMABuffer_RequestedPeriod)<=0) return(0);
Jordi Bassaganas
3521
Jordi Bassaganas 2013.09.25 13:05  
angevoyageur:

You have to use an other handle for DEMA with requested Period as parameter.

Then you can use Bars() function. That gives something like :

You're a truly expert! Thank you for this detail.
Alain Verleyen
Moderator
29606
Alain Verleyen 2013.09.25 16:25  
laplacianlab:
You're a truly expert! Thank you for this detail.
You are welcome, I try my best.
/
To add comments, please log in or register