Miscellaneous
0
Views
0
Downloads
0
Favorites
percent
//+------------------------------------------------------------------+
//| percent.mq4 |
//| neo |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "neo"
#property link "http://www.metaquotes.net"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 1
#property indicator_color1 Black
//---- input parameters
extern int N=60;
//---- indicator buffers
double perct[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexDrawBegin(0,N);
SetIndexBuffer(0,perct);
SetIndexStyle(0,DRAW_LINE);
SetIndexLabel(0,"percent");
return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
int start()
{
int count=1;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
//---- main loop
for(int i=0; i<Bars-N; i++)
{
count = 0;
for(int k=1; k<=N; k++)
{
if( Close[i]>=Open[i+k] && Close[i]<=Close[i+k] ) count++;
}
perct[i]=1.0*count/N*100;
}
//---- done
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
---