Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
CatBarColor
//+------------------------------------------------------------------+
//| CatBarColor.mq4 |
//| Kalenzo |
//| bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link "bartlomiej.gorski@gmail.com"
#property indicator_chart_window
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_buffers 2
double a[],b[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,0,1);
SetIndexStyle(1,DRAW_HISTOGRAM,0,1);
SetIndexBuffer(0,a);
SetIndexBuffer(1,b);
SetIndexLabel(0,"Above MA");
SetIndexLabel(1,"Bellow MA");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) counted_bars=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i = limit ;i >= 0 ;i--)
{
double ma = iMA(Symbol(),0,50,0,MODE_EMA,PRICE_CLOSE,i);
if( ma > High[i] )
{//red
a[i] = High[i];
b[i] = Low[i];
}
else if( ma < Low[i] )
{//blue
a[i] = Low[i];
b[i] = High[i];
}
else
{
a[i]=EMPTY_VALUE;
b[i]=EMPTY_VALUE;
}
}
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
---