您需要 登录 才可以下载或查看,没有帐号?注册
//+------------------------------------------------------------------+
//| 勇-顶底显示.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 i--)
{
VAR1 i =Open[i+1];
OPEN1=MAX(Open i -VAR1 i
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
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
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
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 }
if(TOP i 86) { Xiaoding i } else { Xiaoding i }
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
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!