Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
maxBar
// corewintt
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Coral
#property indicator_color2 SeaGreen
#property indicator_color3 Green
//---- input parameters
extern int Median=10;
extern int Max=10;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
//----
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) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
if(counted_bars==0) limit-=1+Max;
double diff;
for(int i=0; i<limit;i++)
ExtMapBuffer1[i]=High[i]-Low[i];
for(i=0; i<limit;i++)
ExtMapBuffer2[i]=iMAOnArray(ExtMapBuffer1,0,Median,0,MODE_SMA,i);
i=0;
while(i<limit)
{
ExtMapBuffer3[i]=ExtMapBuffer2[i];
for(int R=0; R<Max;R++) if(ExtMapBuffer3[i]<ExtMapBuffer2[i+R]) ExtMapBuffer3[i]=ExtMapBuffer2[i+R];
i++;
}
//----
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
---