[MT4指标]庆祝:编出本人第一个MT指标,发贴庆贺.
首先要特别感谢hawkie ,在他的帮助下为我编写了KDJ指标的变形,使我大受启发,初步了解了MT编程的逻辑结构,才有了我自己编写的第一个指标. 刚刚会编指标,很是兴奋,特贴出来献丑,还请论坛上的各位大侠以后多多赐教.
指标很简单,就是三根均线,每根均线是别的两根均线的算术平均.
//+------------------------------------------------------------------+
//| benben_ma.mq4 |
//| Copyright ?2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Blue
//---- input parameters
double ma1a;
double ma1b;
double ma1c;
double ma5;
double ma8;
double ma13;
double ma21;
double ma34;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(8);
SetIndexBuffer(0, ma1a);
SetIndexLabel(0, "MA1a");
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(1, ma1b);
SetIndexLabel(1, "MA1b");
SetIndexStyle(1, DRAW_LINE);
SetIndexBuffer(2, ma1c);
SetIndexLabel(2, "MA1c");
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(3, ma5);
SetIndexBuffer(4, ma8);
SetIndexBuffer(5, ma13);
SetIndexBuffer(6, ma21);
SetIndexBuffer(7, ma34);
IndicatorShortName("BENBEN-ma");
SetIndexLabel(0,"ma1a");
SetIndexLabel(1,"ma1b");
SetIndexLabel(2,"ma1c");
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
//----
limit=Bars-counted_bars;
for(i=0;iqingzhu.GIF
发表于:2005-07-28 15:06只看该作者
2楼
......厉害....偶一直就没有入门........
另外贴代码的时候这样最好这样贴 要不导入到mt中的时候会有错误
3楼
老正版主,上面的代码是怎么改的呀?为什么我贴的时候后面部分是斜体字?
韬客社区www.talkfx.co
4楼
呵呵,知道了,在置顶的帖子上有介绍
韬客社区www.talkfx.co
发表于:2005-07-29 17:36只看该作者
5楼
不错
韬客社区www.talkfx.co
发表于:2017-08-07 12:00只看该作者
6楼
谢谢分享,学习学习
韬客社区www.talkfx.co