//+------------------------------------------------------------------+ //| 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); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains close prices for each bar
Series array that contains open prices of each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: