MetaTrader(中文)编程入门教程

MetaTrader编程入门教程(0)----指标文件构成汇客论坛整理www.51wendang.com

//双些线后是单行注释,用于注解,自用说明。/*和*/包起来实现多行注释,记录自己的说明

介绍,编程使用记录等

//MQL4语言基本服从C语言的规则-----------注意目前MetaEditor处理不好多字节代码,所以

不要在代码中使用中文和中文空格-------------+

//每个指标文件只是至少包括三个部分(1)property和参数,数组声明,(2)初始化函数nit(),

(3)主函数start()

//property是各种说明信息

//最重要必须的是这三种,(1)说明指标将画在价格窗口还是独立的窗口

//(2)有多少个(1~7)储存指标数据的数组,(3)说明对应将画指标的绘画颜色,编号1~7

#propertyindicator_chart_window

#propertyindicator_buffers1

#propertyindicator_color1Red

//----可设置的参数,可根据需要,由使用者设置

externintMA_Period=13;

externintMA_Shift=0;

externintMA_Method=2;

externintMA_Price=6;

/*MA_Method=

MODE_SMA0Simplemovingaverage,

MODE_EMA1Exponentialmovingaverage,

MODE_SMMA2Smoothedmovingaverage,

MODE_LWMA3Linearweightedmovingaverage.

*/

/*MA_Price=

PRICE_CLOSE0Closeprice.

PRICE_OPEN1Openprice.

PRICE_HIGH2Highprice.

PRICE_LOW3Lowprice.

PRICE_MEDIAN4Medianprice,(high+low)/2.

PRICE_TYPICAL5Typicalprice,(high+low+close)/3.

PRICE_WEIGHTED6Weightedcloseprice,(high+low+close+close)/4.

*/

//数组,储存指标数据

doubleBuffer0[];

//|初始化准备函数,装入时调用一次

intinit()

{

//-设置编号为0的线的线形等参数,0~6,对应indicator_color1~7

你可能喜欢

  • 智能交易
  • mt4编程
  • MQL4语言
  • MT4教程
  • 交易高手
  • MT4指标

MetaTrader(中文)编程入门教程相关文档

最新文档

返回顶部