你这个 要看 MT4 macd指标的源代码来分析:

//+------------------------------------------------------------------+

//|                                                  Custom MACD.mq4 |

//|                   Copyright 2005-2014, MetaQuotes Software Corp. |

//|                                              http://www.mql4.com |

//+------------------------------------------------------------------+

#property copyright   "2005-2014, MetaQuotes Software Corp."

#property link        "http://www.mql4.com"

#property description "Moving Averages Convergence/Divergence"

#property strict

#include

//--- indicator settings

#property  indicator_separate_window

#property  indicator_buffers 2

#property  indicator_color1  Silver

#property  indicator_color2  Red

#property  indicator_width1  2

//--- indicator parameters

input int InpFastEMA=12;   // Fast EMA Period

input int InpSlowEMA=26;   // Slow EMA Period

input int InpSignalSMA=9;  // Signal SMA Period

//--- indicator buffers

double    ExtMacdBuffer[];

double    ExtSignalBuffer[];

//--- right input parameters flag

bool      ExtParameters=false;

//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int OnInit(void)

{

IndicatorDigits(Digits+1);

//--- drawing settings

SetIndexStyle(0,DRAW_HISTOGRAM);

SetIndexStyle(1,DRAW_LINE);

SetIndexDrawBegin(1,InpSignalSMA);

//--- indicator buffers mapping

SetIndexBuffer(0,ExtMacdBuffer);

SetIndexBuffer(1,ExtSignalBuffer);

//--- name for DataWindow and indicator subwindow label

IndicatorShortName("MACD("+IntegerToString(InpFastEMA)+","+IntegerToString(InpSlowEMA)+","+IntegerToString(InpSignalSMA)+")");

SetIndexLabel(0,"MACD");

SetIndexLabel(1,"Signal");

//--- check for input parameters

if(InpFastEMA<=1 || InpSlowEMA<=1 || InpSignalSMA<=1 || InpFastEMA>=InpSlowEMA)

{

Print("Wrong input parameters");

ExtParameters=false;

return(INIT_FAILED);

}

else

ExtParameters=true;

//--- initialization done

return(INIT_SUCCEEDED);

}

//+------------------------------------------------------------------+

//| Moving Averages Convergence/Divergence                           |

//+------------------------------------------------------------------+

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[])

{

int i,limit;

//---

if(rates_total<=InpSignalSMA || !ExtParameters)

return(0);

//--- last counted bar will be recounted

limit=rates_total-prev_calculated;

if(prev_calculated>0)

limit++;

//--- macd counted in the 1-st buffer

for(i=0; i

ExtMacdBuffer=iMA(NULL,0,InpFastEMA,0,MODE_EMA,PRICE_CLOSE,i)-

iMA(NULL,0,InpSlowEMA,0,MODE_EMA,PRICE_CLOSE,i);

//--- signal line counted in the 2-nd buffer

SimpleMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer);

//--- done

return(rates_total);

}

//+------------------------------------------------------------------+

php计算macd,MT4里的MACD和平常所用的MACD计算公式是什么?相关推荐

  1. 双线macd指标参数最佳设置_mt5怎么添加双线macd?mt5中macd怎么设置快慢线?

    在mt4平台中怎么添加双线macd指标 的设置要求是这样的 将MACD的快速EMA参数设定为8,将慢速EMA参数设定.打开mt4,菜单栏选择,数据文件夹--mql4---indicator,将技术指标 ...

  2. python文件数据总和计算_python 计算文件夹里所有内容的大小总和

    计算文件夹里所有内容的大小总和 递归方法 '''计算文件夹的大小''' import os def dir_file_size(path): if os.path.isdir(path): file_ ...

  3. python代码计算字数_Python计算一个文件里字数的方法

    本文实例讲述了Python计算一个文件里字数的方法.分享给大家供大家参考.具体如下: 这段程序从所给文件中找出字数来. from string import * def countWords(s): ...

  4. 雾计算?边缘计算?云里雾里还被边缘?

    雾计算?边缘计算?云里雾里还被边缘? 我们都知道云计算,近两年又出现了雾计算.边缘计算,搞得人云里雾里分不清.这些概念究竟是什么意思?和我们的生活有什么关系?这篇文章来一探究竟. 1.雾计算的来头 当 ...

  5. 根据经纬度计算范围_高中地理必修一二三思维导图+计算公式全汇总!能用3年...

    必修一 必修二 必修三 计算公式 1.经纬度计算:经度差与地方时差算经度--地方时每相差1小时,经度相差1°;纬差法与正午太阳高度算纬度--正午太阳相差多小,纬度相差多少;北极星的仰角即地平高度等于当 ...

  6. MACD与OBV结合,用OBV进行改进MACD指标公式

    能量潮指标,英文简称OBV,是On Balance Volume的缩写.OBV指标结合涨跌情况,对成交量进行处理.本文结合MACD与OBV,用OBV进行改进MACD指标公式. 一.能量潮(OBV)指标 ...

  7. macd的VB计算机程序,基于动态VWAP算法和MACD分析的程序化交易研究

    摘要: 在1975年的纽约证券交易所(NYSE),出现了把不同的股票按不同的比例同时进行交易的情况,如果交易总金额超过100万美金交易数量超过15个,那么当时的NYSE就将这种交易叫做程序化交易.随着 ...

  8. MACD进阶版指标公式,提前一天判断MACD金叉

    MACD是一种常用的技术分析指标,用于判断价格的趋势和动能,其原理是基于两条指数移动平均线的比较和对价格的平滑处理,MACD金叉是指MACD指标中的快线DIF从下方向上穿过慢线DEA.快线.慢线都是根 ...

  9. 计算属性computed里面的getter和setter

    参考一: 在 Vue 中,computed 的属性可以被视为是 data 一样,可以读取和设值,因此在 computed 中可以分成 getter(读取) 和 setter(设值),一般情况下是没有 ...

  10. macd的python代码同花顺_同花顺资金版MACD(源码 副图 贴图)(图文)

    使用方法和MACD一样, 指标简介: 算法基本上是同MACD一致,并考虑了成交量的变化.使用方法同MACD.金叉买入参考.死叉卖出参考.背离买入等... 使用时请结合技术指标.成交量.大盘走势等多因素 ...

最新文章

  1. c语言中void跟argv,argc和argv []在C语言中
  2. asp.net request编码问题,(转载)
  3. struts2的bean类名首字母和第二个字母都不能大写
  4. C# .NET Web API 如何自訂 ModelBinder
  5. deprecated_使用Java的@Deprecated前瞻
  6. 计算机网络——链路层之信道
  7. 开关造成的毛刺_解决交易中的毛刺问题,你可以这样做
  8. 从零开始使用Vscode调试XV6
  9. linux 配置jdk 环境变量 没效果,linux下jdk环境变量配置深度分析----解决环境变量不生效的问题...
  10. 音视频开发系列(49)视频编码标准发展史
  11. CVE-2017-8464 震网三代
  12. 第一章 汇编语言和汇编指令
  13. 保护视力方面的电脑设定
  14. php strpos 性能,PHP中的stristr(),strstr(),strpos()速度比較
  15. 思科ccna认证工程师必看路由协议IGRP和EIGRP详解
  16. 面试官:Spring 用了哪些设计模式?说三种即可 = =
  17. Idea工具如何使用
  18. 彻底搞懂弹性布局flex
  19. 创业之路---IT销售中几种销售提成激励方案的比较
  20. 不用手机,如何让猫给你打视频电话 | 日常小技

热门文章

  1. 网站CDN加速是什么? 看完这篇你就明白了!
  2. redis 中pipline,mset, mget使用对比
  3. Windows开启ssh服务配合 IOS 快捷指令完成骚操作
  4. POJ 3233 Matrix Power Series(矩阵快速幂)
  5. ArcGis 地理配准注意事项
  6. 求职时,怎样判断一家公司是否靠谱?
  7. 电脑IP地址查看及修改
  8. rsync用法详细解释
  9. 解决苹果手机双击页面放大的问题
  10. win10 dnf服务器未响应怎么办,手把手研习win10系统DNF游戏死机的具体教程