外汇论坛 外兔财经

开启左侧

MT4的MACD

[复制链接]
发表于 2005-7-20 07:51 | 显示全部楼层 |阅读模式
https://www.y2cn.com
这几天才开始用MT4,
MACD只有一根线,请问怎样可以再调出一根线出来?。
发表于 2005-8-1 14:51 | 显示全部楼层
需要修改一下指标参数计算。

//+------------------------------------------------------------------+
//|                                                 MACD_Billwin.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_separate_window
#property indicator_buffers 3
#property indicator_color1 Aqua
#property indicator_color2 Red
#property indicator_color3 Silver
//---- input parameters
extern int       FastEMA=12;
extern int       SlowEMA=26;
extern int       SignalSMA=9;

//---- buffers
double ExtMapBuffer3[];
//---- indicator buffers
double ExtSilverBuffer[];
double ExtRedBuffer[];
double ExtAquaBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,ExtMapBuffer3);
//----
   SetIndexDrawBegin(1,SignalSMA);
   IndicatorDigits(5);
//---- indicator buffers mapping
   SetIndexBuffer(0, ExtSilverBuffer);
   SetIndexBuffer(1, ExtRedBuffer);
   SetIndexBuffer(2, ExtAquaBuffer);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("BillWin_MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer

   for(int i=0; i<limit; i++)
      ExtSilverBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      ExtRedBuffer=iMAOnArray(ExtSilverBuffer,Bars,SignalSMA,0,MODE_SMA,i);
   for(i=0; i<limit; i++)
      ExtAquaBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i) - iMAOnArray(ExtSilverBuffer,Bars,SignalSMA,0,MODE_SMA,i);
//---- done
   return(0);
  }
//+------------------------------------------------------------------+。
发表于 2005-8-9 10:29 | 显示全部楼层
能讲详细些怎么修改吗???? 谢谢。
 楼主| 发表于 2005-8-9 23:48 | 显示全部楼层
真是电脑高手,多谢,只可惜我不懂。
发表于 2005-8-13 16:09 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2005-8-13 16:09 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2006-6-4 05:38 | 显示全部楼层
请教:两根先的,好何何搞成一根.
先谢了.
发表于 2006-6-6 22:32 | 显示全部楼层
不错~~~
发表于 2006-7-10 01:40 | 显示全部楼层
我知道
发表于 2008-12-4 01:34 | 显示全部楼层

本版积分规则

QQ|手机版 Mobile Version|Archiver|关于我们 About Us|联系我们 Contact Us|Y2外汇论坛 外兔财经

GMT+8, 2024-5-5 09:29 , Processed in 0.064665 second(s), 24 queries .

Powered by Discuz! X7.2

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表