Download MetaTrader 5

Retrieving buffers from Custom Indicators

To add comments, please log in or register
Copy the deals of successful traders. Subscribe to signals!
Sean Blair
9
Sean Blair 2010.01.12 07:10 

I am trying to access buffers 1 and 2 from the ZigZag Indicator via an indicator I am developing which uses the values stored in those two buffers. I have been using the CopyBuffer function passing as the second parameter the ordinal of the buffer I want to access. I realize when I use 1 or 2 it does not work, i.e. CopyBuffer returns -1, however if I use the ordinal 0 (which I do not need) CopyBuffer returns a result.

Are there any examples of indicators done that I could reference or does anyone know why would this be?

 Thanks

sablair 

Paul
784
Paul 2010.01.12 08:17  
sablair   :

I am trying to access buffers 1 and 2 from the ZigZag Indicator via an indicator I am developing which uses the values stored in those two buffers. I have been using the CopyBuffer function passing as the second parameter the ordinal of the buffer I want to access. I realize when I use 1 or 2 it does not work, i.e. CopyBuffer returns -1, however if I use the ordinal 0 (which I do not need) CopyBuffer returns a result.

Are there any examples of indicators done that I could reference or does anyone know why would this be?

 Thanks

sablair 

I think your problem is probably because the second and third indicator buffers in the zigzag code are of type "INDICATOR_CALCULATIONS".  Suggest changing them to "INDICATOR_DATA", altough that may not be the only change you have to do

   SetIndexBuffer(0,ZigzagBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,HighMapBuffer,INDICATOR_CALCULATIONS);
   SetIndexBuffer(2,LowMapBuffer,INDICATOR_CALCULATIONS);

Paul

http://paulsfxrandomwalk.blogspot.com/ 

Regularly emailing the status of an account
  • 2012.06.14
  • Paul
  • paulsfxrandomwalk.blogspot.com
Prompted by a query, I thought I'd post a useful little utility that I have used for ages which emails the status of the account every hour.  After lengthy deliberation I decided to call it .... EmailStatus.  With only a small modification it could be used to log the status to a file, and the time...
To add comments, please log in or register