MT4多周期RSI外汇MT4指标(标准编写)
//+------------------------------------------------------------------+
//| eXclusive MTF RSI.mq4 |
//| Copyright ?2013, mt4exclusive.com |
//| http://www.mt4exclusive.com |
//+------------------------------------------------------------------+
[color=]#property copyright "Copyright ?2013, mt4exclusive.com"
[color=]#property link "http://www.mt4exclusive.com"
[color=]#property indicator_color1 Red//设置各个外汇MT4指标线的“颜色”
[color=]#property indicator_color2 Lime
[color=]#property indicator_color3 Orange
[color=]#property indicator_color4 Blue
[color=]#property indicator_color5 White
[color=]#property indicator_color6 Green
[color=]#property indicator_color7 Yellow
[color=]#property indicator_color8 Moccasin
[color=]#property indicator_separate_window//单独窗口中显示外汇MT4指标
[color=]#property indicator_minimum 0
[color=]#property indicator_maximum 100
[color=]#property indicator_buffers 8//外汇MT4指标的“缓冲区数量”
[color=]#property indicator_level1 70//外汇MT4指标的“水平位”
[color=]#property indicator_level2 30
[color=]#property indicator_level3 50
//以下为外汇MT4指标的“输入参数”extern int RSIperiod=
[color=]14
;extern int RSIprice =
[color=]0
;extern
[color=]string
RSI_Price_note_1=
[color=]"CLOSE= 0, OPEN=1, HIGH=2, LOW=3"
;extern
[color=]string
RESI_Price_note2=
[color=]"MEDIAN=4, TYPICAL=5, WEIGHTED=6"
;extern bool ShowRSI_M1 =
[color=]true
;extern bool ShowRSI_M5 =
[color=]true
;extern bool ShowRSI_M15 =
[color=]true
;extern bool ShowRSI_M30 =
[color=]true
;extern bool ShowRSI_M60 =
[color=]true
;extern bool ShowRSI_M240=
[color=]true
;extern bool ShowRSI_M1440=
[color=]true
;extern bool ShowRSI_M10080=
[color=]true
;extern color M1_color=Red;extern color M5_color=Lime;extern color M15_color=Orange;extern color M30_color=Blue;extern color M60_color=White;extern color M240_color=Green;extern color M1440_color=Yellow;extern color M10080_color=Moccasin;double M1Buffer[];
//设置双精度数组变量double M5Buffer[];double M15Buffer[];double M30Buffer[];double M60Buffer[];double M240Buffer[];double M1440Buffer[];double M10080Buffer[];int TF1=
[color=]1
;
//设置整形变量int TF5=
[color=]5
;int TF15=
[color=]15
;int TF30=
[color=]30
;int TF60=
[color=]60
;int TF240=
[color=]240
;int TF1440=
[color=]1440
;int TF10080=
[color=]10080
;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+int init() {
//---- indicators
//============================================================================================
//IndexBuffer为外汇MT4指标缓冲区(index英文有外汇MT4指标的意思,但也有索引的意思,即第几个外汇MT4指标缓冲区),外汇MT4指标缓冲区的个数由 IndicatorBuffers() 函数设定并且不能超过8个。
//SetIndexBuffer:即将第几个自定义的外汇MT4指标缓冲区绑定到指定数组array[]。 SetIndexBuffer(
[color=]0
,M1Buffer);
//将第1个外汇MT4指标缓冲区绑定到数组M1Buffer SetIndexLabel(
[color=]0
,
[color=]"M1 RSI"
);
//设置外汇MT4指标标签为"M1 RSI",当光标移动到该外汇MT4指标线上时,显示该名称,以及对应的数值
//SetIndexStyle() – 设置指定的外汇MT4指标线设置新类型、样式、宽度和颜色。
//void SetIndexStyle(int index, int type, void style, void width, void clr)
//index - 外汇MT4指标线。必须在0至7之间。
//type - 形状样式,可以是 划线形状样式列表 中任意一个。
//style - 线型。可以应用一个像素的粗线,可以是 划线形状样式列表 其中一个。EMPTY值表示线型不变。
//width - 线宽。有效值是1,2,3,4,5。EMPTY值表示线宽不变。
//clr - 线的颜色。省略本参数表示颜色将保持不变 SetIndexStyle(
[color=]0
,DRAW_LINE,
[color=]0
,
[color=]1
,M1_color);
//第一个外汇MT4指标线画成红色的线型,宽度为1
//============================================================================================ SetIndexBuffer(
[color=]1
,M5Buffer); SetIndexLabel(
[color=]1
,
[color=]"M5 RSI"
); SetIndexStyle(
[color=]1
,DRAW_LINE,
[color=]0
,
[color=]1
,M5_color);
//============================================================================================ SetIndexBuffer(
[color=]2
,M15Buffer); SetIndexLabel(
[color=]2
,
[color=]"M15 RSI"
); SetIndexStyle(
[color=]2
,DRAW_LINE,
[color=]0
,
[color=]1
,M15_color);
//============================================================================================ SetIndexBuffer(
[color=]3
,M30Buffer); SetIndexLabel(
[color=]3
,
[color=]"M30 RSI"
); SetIndexStyle(
[color=]3
,DRAW_LINE,
[color=]0
,
[color=]1
,M30_color);
//============================================================================================ SetIndexBuffer(
[color=]4
,M60Buffer); SetIndexLabel(
[color=]4
,
[color=]"H1 RSI"
); SetIndexStyle(
[color=]4
,DRAW_LINE,
[color=]0
,
[color=]1
,M60_color);
//============================================================================================ SetIndexBuffer(
[color=]5
,M240Buffer); SetIndexLabel(
[color=]5
,
[color=]"H4 RSI"
); SetIndexStyle(
[color=]5
,DRAW_LINE,
[color=]0
,
[color=]1
,M240_color);
//============================================================================================ SetIndexBuffer(
[color=]6
,M1440Buffer); SetIndexLabel(
[color=]6
,
[color=]"D1 RSI"
); SetIndexStyle(
[color=]6
,DRAW_LINE,
[color=]0
,
[color=]1
,M1440_color);
//============================================================================================ SetIndexBuffer(
[color=]7
,M10080Buffer); SetIndexLabel(
[color=]7
,
[color=]"W1 RSI"
); SetIndexStyle(
[color=]7
,DRAW_LINE,
[color=]0
,
[color=]1
,M10080_color);
//============================================================================================ IndicatorShortName(
[color=]"eXclusive MTF_RSI("
+RSIperiod+
[color=]")"
);
//外汇MT4指标窗口左上角显示的“外汇MT4指标名称” return(
[color=]0
); }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+int deinit()//清空内存 {
//----
//The function removes the object with the specified name at the specified chart. There are two variants of the function:
//该函数在指定的图表中移除具有指定名称的对象。 ObjectDelete(
[color=]"M1RSI"
);
// ObjectDelete(
[color=]"M5RSI"
); ObjectDelete(
[color=]"M15RSI"
); ObjectDelete(
[color=]"M30RSI"
); ObjectDelete(
[color=]"H1RSI"
); ObjectDelete(
[color=]"H4RSI"
); ObjectDelete(
[color=]"D1RSI"
); ObjectDelete(
[color=]"W1RSI"
); ObjectDelete(
[color=]"M1ValueRSI"
); ObjectDelete(
[color=]"M5ValueRSI"
); ObjectDelete(
[color=]"M15ValueRSI"
); ObjectDelete(
[color=]"M30ValueRSI"
); ObjectDelete(
[color=]"H1ValueRSI"
); ObjectDelete(
[color=]"H4ValueRSI"
); ObjectDelete(
[color=]"D1ValueRSI"
); ObjectDelete(
[color=]"W1ValueRSI"
);
//---- return(
[color=]0
); }
//============================================================================================int start() { if(ShowRSI_M1 && Period()if(ShowRSI_M5 && Period()if(ShowRSI_M15 && Period()if(ShowRSI_M30 && Period()if(ShowRSI_M60 && Period()if(ShowRSI_M240 && Period()if(ShowRSI_M1440 && Period()if(ShowRSI_M10080 && Period()return(
[color=]0
); }
//============================================================================================
//============================================================================================int start1() { datetime TimeArray1[]; int i,limit,y=
[color=]0
,counted_bars=IndicatorCounted(); ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),
[color=]1
); limit=Bars-counted_bars; for(i=
[color=]0
,y=
[color=]0
;iif (yif(Timereturn(
[color=]0
); }
//============================================================================================int start2() { datetime TimeArray2[]; int i,limit,y=
[color=]0
,counted_bars=IndicatorCounted(); ArrayCopySeries(TimeArray2,MODE_TIME,Symbol(),TF5); limit=Bars-counted_bars; for(i=
[color=]0
,y=
[color=]0
;iif (yif(Timereturn(
[color=]0
); }
//============================================================================================int start3() { datetime TimeArray3[]; int i,limit,y=
[color=]0
,counted_bars=IndicatorCounted(); ArrayCopySeries(TimeArray3,MODE_TIME,Symbol(),TF15); limit=Bars-counted_bars; for(i=
[color=]0
,y=
[color=]0
;iif (yif(Timereturn(
[color=]0
); }
//============================================================================================int start4() { datetime TimeArray4[]; int i,limit,y=
[color=]0
,counted_bars=IndicatorCounted(); ArrayCopySeries(TimeArray4,MODE_TIME,Symbol(),TF30); limit=Bars-counted_bars; for(i=
[color=]0
,y=
[color=]0
;iif (yif(Timereturn(
[color=]0
); }
//============================================================================================int start5() { datetime TimeArray5[]; int i,limit,y=
[color=]0
,counted_bars=IndicatorCounted(); ArrayCopySeries(TimeArray5,MODE_TIME,Symbol(),TF60); limit=Bars-counted_bars; for(i=
[color=]0
,y=
[color=]0
;iif (yif(Timereturn(
[color=]0
); }
//============================================================================================int start6() { datetime TimeArray6[]; int i,limit,y=
[color=]0
,counted_bars=IndicatorCounted(); ArrayCopySeries(TimeArray6,MODE_TIME,Symbol(),TF240); limit=Bars-counted_bars; for(i=
[color=]0
,y=
[color=]0
;iif (yif(Timereturn(
[color=]0
); }
//============================================================================================int start7() { datetime TimeArray7[]; int i,limit,y=
[color=]0
,counted_bars=IndicatorCounted(); ArrayCopySeries(TimeArray7,MODE_TIME,Symbol(),TF1440); limit=Bars-counted_bars; for(i=
[color=]0
,y=
[color=]0
;iif (yif(Timereturn(
[color=]0
); }
//============================================================================================int start8() { datetime TimeArray8[]; int i,limit,y=
[color=]0
,counted_bars=IndicatorCounted(); ArrayCopySeries(TimeArray8,MODE_TIME,Symbol(),TF10080); limit=Bars-counted_bars; for(i=
[color=]0
,y=
[color=]0
;iif (yif(Timereturn(
[color=]0
); }
//============================================================================================
//============================================================================================void CreateLabel(string name,int x,int y,int corner,int z,string text,int size, string font="Arial") { ObjectCreate(name,OBJ_LABEL,WindowFind(
[color=]"eXclusive MTF_RSI("
+RSIperiod+
[color=]")"
),
[color=]0
,
[color=]0
); ObjectSet(name,OBJPROP_CORNER,corner); ObjectSet(name,OBJPROP_COLOR,z); ObjectSet(name,OBJPROP_XDISTANCE,x); ObjectSet(name,OBJPROP_YDISTANCE,y); ObjectSetText(name,text,size,font,z); }
//============================================================================================
复制代码
大家在看了小编以上对"MT4多周期RSI外汇MT4指标(标准编写)"的介绍后应该都清楚了吧,希望对大家做单有所帮助。如果大家还想要下载更多有关"MT4多周期RSI外汇MT4指标(标准编写)"的相关EA源码,敬请关注汇探网下载。我们会持续更新交易系统,EA源码。 |