我在学写ea 大概可以帮你 写好了 我就发上来
//+------------------------------------------------------------------+
//| 空指标.mq4 |
//| FF |
//| baidu.com |
//+------------------------------------------------------------------+
#property copyright "FF"
#property link "baidu.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
#property indicator_buffers 3 // 缓冲的数目
#property indicator_color1 Blue // 第1条指标线的颜色
#property indicator_color2 Red //
#property indicator_color3 Yellow
#property description " 十单位周期 收盘价 最高价 最低价 均线组\n"
#property description " 蓝 红 黄 分别对应 收盘 最高 最低价\n"
#property description " qq 754702831"
double Buf_0[],Buf_1[],Buf_2[];
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,Buf_0); // 第一个缓冲赋值
SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1); // 第一条指标线的特点
SetIndexBuffer(1,Buf_1);
SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(2,Buf_2);
SetIndexStyle (2,DRAW_LINE,STYLE_SOLID,1);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
//--- return value of prev_calculated for next call
int i,Counted_bars; // 当前柱子的数目
//--------------------------------------------------------------------
Counted_bars=IndicatorCounted(); // 历史柱子的数目
i=Bars-Counted_bars-1; // 第一个历史柱的索引
while(i>=0) // 历史柱的循环
{
Buf_0[i]=iMA(NULL,0,10,0,MODE_SMA,PRICE_CLOSE,i); // 第一个缓冲第 i 个柱的数据值
Buf_1[i]=iMA(NULL,0,10,0,MODE_SMA,PRICE_HIGH,i); // 第二个缓冲第 i 个柱的数据值
Buf_2[i]=iMA(NULL,0,10,0,MODE_SMA,PRICE_LOW,i);
i--; // 计算下一个柱
}
//--------------------------------------------------------------------
// return 0; // 退出 start()
return(rates_total);
}
//+------------------------------------------------------------------+
/*
M1:SMA(MA(CLOSE,10),2,1);
M2:SMA(MA(HIGH,10),3,1);
M3:SMA(MA(LOW,10),3,1);
分别以收市价格,最高价格,最低价格运用SMA函数表示10日均线!
*/
运行演示
M2:SMA(MA(HIGH,10),3,1);
M3:SMA(MA(LOW,10),3,1);
这个指标是博弈大师里面的,分别以收市价格,最高价格,最低价格运用SMA函数表示10日均线!
跪求大神帮忙别写成MT4指标,拜谢!