//+------------------------------------------------------------------+
//| 勇-顶底显示.mq4 |
//| Copyright 2010年6月30日 |
//| 第一版 |
//+------------------------------------------------------------------+
#property copyright \"Copyright 2010年6月30日\"
#property link \"第一版\"
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 4
#property indicator_color1 Gold
#property indicator_width1 2
#property indicator_color2 Red
#property indicator_width2 2
#property indicator_color3 SeaGreen
#property indicator_width3 2
#property indicator_color4 Gold
#property indicator_width4 2
//---- input parameters
extern int N1=7;
//---- buffers
//---- buffers
double Dading[]; //大顶线
double Xiaoding[]; //小顶线
double Xiaodi[]; //小底线
double Dadi[]; //大底线
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Dading);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,Xiaoding);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,Xiaodi);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,Dadi);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
//----
{
int i,limit,counted_bars=IndicatorCounted();//烛线数,函数返回柱的总数
double OPEN1[],CLOSE1[],HIGH1[],LOW1[],OPEN2[],CLOSE2[],HIGH2[],LOW2[];
limit=Bars-counted_bars;
//---- 检验可能出现错误
if(counted_bars0) counted_bars--;
//---- 主环
for(i=0;i0) limit++;
for(i=limit; i>=0; i--)
{
VAR1<i>=Open[i+1];
OPEN1=MAX(Open<i>-VAR1<i>,0);
OPEN2<i>=ABS(Open<i>-VAR1<i>);
VOPEN<i>=iMA(NULL,0,N1,0,MODE_SMA,OPEN1<i>,i)/iMA(NULL,0,N1,0,MODE_SMA,OPEN2<i>,i)*100;
VAR3<i>=Close[i+1];
CLOSE1<i>=MAX(Close<i>-VAR3<i>,0);
CLOSE2<i>=ABS(Close<i>-VAR3<i>);
VCLOSE<i>=iMA(NULL,0,N1,0,MODE_SMA,CLOSE1<i>,i)/iMA(NULL,0,N1,0,MODE_SMA,CLOSE2<i>,i)*100;
VAR5<i>=High[i+1];
HIGH1<i>=MAX(High<i>-VAR5<i>,0);
HIGH2<i>=ABS(High<i>-VAR5<i>);
VHIGH<i>=iMA(NULL,0,N1,0,MODE_SMA,HIGH1<i>,i)/iMA(NULL,0,N1,0,MODE_SMA,HIGH2<i>,i)*100;
VAR7<i>=Low[i+1];
LOW1<i>=MAX(Low<i>-VAR1<i>,0);
LOW2<i>=ABS(Low<i>-VAR1<i>);
VLOW<i>=iMA(NULL,0,N1,0,MODE_SMA,LOW1<i>,i)/iMA(NULL,0,N1,0,MODE_SMA,LOW2<i>,i)*100;
TOP2<i>=MAX(VHIGH<i>,VLOW<i>);
TOP1<i>=MAX(TOP2<i>,VOPEN<i>);
TOP<i>=MAX(TOP1<i>,VCLOSE<i>);
BOTTOM2<i>=MIN(VHIGH<i>,VLOW<i>);
BOTTOM1<i>=MIN(BOTTOM2<i>,VOPEN<i>);
BOTTOM<i>=MIN(BOTTOM1<i>,VCLOSE<i>);
if(TOP<i>>95) { Dading<i>=100; } else { Dading<i>=75; }
if(TOP<i>>86) { Xiaoding<i>=70; } else { Xiaoding<i>=55; }
if(BOTTOM<i>DD)
{XX=DD; }
else {XX=CC;}
//----
return(XX);
}
//+-----------求最小值END-----------------------------------------------+
//+------------求绝对值---------------------------------------------+
double ABS(double EE)
{ double ZZ;
//----
if (EE95,100,75),LINETHICK2 ,COLORWHITE;
//小顶:IF(TOP>86,70,55),LINETHICK2,COLORRED;
//顶:大顶 = 100 OR 小顶 = 70,COLORWHITE;
//小底:IF(BOTTOM |