0
Views
0
Downloads
0
Favorites
GrabBuffers
//+------------------------------------------------------------------+
//| GrabBuffers.mq4 |
//+------------------------------------------------------------------+
// IndicatorName is the .mq4/.ex4 filename. You do not need to have
// the source code (i.e. .mq4 file) to read from the buffers.
//
// The Indicator you're analyzing does not have to be on the current
// chart, but it makes it easier because you have to analyze because
// you can compare the Buffer output with changes in the Indicator.
// For example, if the indicator changes color and suddenly a different
// buffer is being used, then it may be that that particular color
// is assigned to that buffer
//
// Look at the scale on the indicator right side. If the scale is
// 0.0000 to 0.0004 and you see the indicator at 0.0100 (you can
// also hover the mouse over the indicator to get the current value)
// and it moves to 0.0110 and the value of a buffer changes to match
// that, then you've discovered the buffer which is being used to
// carry the current value of the indicator.
//
// If a buffer has a huge number like 217344678.99, then that value
// is set to No Value in the indicator.
//
// The 8 accessible buffers (buffers 0 through 7) from iCustom are doubles, even if they
// only carry integer values in them
//
// A buffer can be used for storing a number (e.g. value of the ATR in the indicator window)
// or to trigger a particular color to be displayed. For example, Buffer 0 = Red,
// Buffer 1 = Green, Buffer 2 = Black. If Buffer 0 = 0, Buffer 1 = 1, and Buffer 2 = 0, then
// the indicator window bar will be Green. This has a great deal of benefit if you want to
// know when a bar changes colors for some trading entry/exit signal. When the buffers are
// used to store numbers, you can detect when there are cossovers. For example with MACD,
// you can see that Buffer 0 is the Histogram value and Buffer 1 is the Trendline value and
// by comparing Buffer0 with Buffer1 you can detect crossover.
//
// Frequently the value under the Properties tab for Color corresponds to the Buffer #. In
// the example of MACD, #0 = Gray and #1 = Red and the values for the Histogram are found
// in Buffer 0 and displayed as Gray. The value of the trendline is found in Buffer 1 and
// displayed in Red. With CCI, Buffer 0 holds the value of the CCI line. If you didn't
// have the source code for CCI, the changes values in Buffers 1, 2, and 3 might not have any
// meaning (you may not be able to figure what they're used for). Looking at the source code
// you can tell that they're used for storing rather than displaying data.
//
#property copyright ""
#property link ""
#property indicator_chart_window
extern string IndicatorName="ATR";
//+------------------------------------------------------------------+
int start()
{
Print("Indicator: "+IndicatorName+" Buffer0="+DoubleToStr(iCustom(NULL,0,IndicatorName,0,0),8)+" Buffer1="+DoubleToStr(iCustom(NULL,0,IndicatorName,1,0),8)+" Buffer2="+DoubleToStr(iCustom(NULL,0,IndicatorName,2,0),8)+" Buffer2="+DoubleToStr(iCustom(NULL,0,IndicatorName,3,0),8)+" Buffer4="+DoubleToStr(iCustom(NULL,0,IndicatorName,4,0),8)+" Buffer5="+DoubleToStr(iCustom(NULL,0,IndicatorName,5,0),8)+" Buffer6="+DoubleToStr(iCustom(NULL,0,IndicatorName,6,0),8)+" Buffer7="+DoubleToStr(iCustom(NULL,0,IndicatorName,7,0),8));
return(0);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---