MT4多周期RSI外汇MT4指标(标准编写)
MT4多周期RSI外汇MT4指标(标准编写)[*]
//+------------------------------------------------------------------+
[*]
//| eXclusive MTF RSI.mq4 |
[*]
//| Copyright ?2013, mt4exclusive.com |
[*]
//| http://www.mt4exclusive.com |
[*]
//+------------------------------------------------------------------+
[*]
#property copyright "Copyright ?2013, mt4exclusive.com"
[*]
#property link "http://www.mt4exclusive.com"
[*][*]
#property indicator_color1 Red//设置各个外汇MT4指标线的“颜色”
[*]
#property indicator_color2 Lime
[*]
#property indicator_color3 Orange
[*]
#property indicator_color4 Blue
[*]
#property indicator_color5 White
[*]
#property indicator_color6 Green
[*]
#property indicator_color7 Yellow
[*]
#property indicator_color8 Moccasin
[*][*]
#property indicator_separate_window//单独窗口中显示外汇MT4指标
[*]
#property indicator_minimum 0
[*]
#property indicator_maximum 100
[*]
#property indicator_buffers 8//外汇MT4指标的“缓冲区数量”
[*]
#property indicator_level1 70//外汇MT4指标的“水平位”
[*]
#property indicator_level2 30
[*]
#property indicator_level3 50
[*][*][*]
//以下为外汇MT4指标的“输入参数”
[*]extern int RSIperiod=
14
;[*]extern int RSIprice =
0
;[*]extern
string
RSI_Price_note_1=
"CLOSE= 0, OPEN=1, HIGH=2, LOW=3"
;[*]extern
string
RESI_Price_note2=
"MEDIAN=4, TYPICAL=5, WEIGHTED=6"
;[*][*]extern bool ShowRSI_M1 =
true
;[*]extern bool ShowRSI_M5 =
true
;[*]extern bool ShowRSI_M15 =
true
;[*]extern bool ShowRSI_M30 =
true
;[*]extern bool ShowRSI_M60 =
true
;[*]extern bool ShowRSI_M240=
true
;[*]extern bool ShowRSI_M1440=
true
;[*]extern bool ShowRSI_M10080=
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=
1
;
//设置整形变量
[*]int TF5=
5
;[*]int TF15=
15
;[*]int TF30=
30
;[*]int TF60=
60
;[*]int TF240=
240
;[*]int TF1440=
1440
;[*]int TF10080=
10080
;[*]
//+------------------------------------------------------------------+
[*]
//| Custom indicator initialization function |
[*]
//+------------------------------------------------------------------+
[*]int init()[*]{[*]
//---- indicators
[*]
//============================================================================================
[*]
//IndexBuffer为外汇MT4指标缓冲区(index英文有外汇MT4指标的意思,但也有索引的意思,即第几个外汇MT4指标缓冲区),外汇MT4指标缓冲区的个数由 IndicatorBuffers() 函数设定并且不能超过8个。
[*]
//SetIndexBuffer:即将第几个自定义的外汇MT4指标缓冲区绑定到指定数组array[]。
[*] SetIndexBuffer(
0
,M1Buffer);
//将第1个外汇MT4指标缓冲区绑定到数组M1Buffer
[*] SetIndexLabel(
0
,
"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(
0
,DRAW_LINE,
0
,
1
,M1_color);
//第一个外汇MT4指标线画成红色的线型,宽度为1
[*]
//============================================================================================
[*] SetIndexBuffer(
1
,M5Buffer);[*] SetIndexLabel(
1
,
"M5 RSI"
);[*] SetIndexStyle(
1
,DRAW_LINE,
0
,
1
,M5_color);[*]
//============================================================================================
[*] SetIndexBuffer(
2
,M15Buffer);[*] SetIndexLabel(
2
,
"M15 RSI"
);[*] SetIndexStyle(
2
,DRAW_LINE,
0
,
1
,M15_color);[*]
//============================================================================================
[*] SetIndexBuffer(
3
,M30Buffer);[*] SetIndexLabel(
3
,
"M30 RSI"
);[*] SetIndexStyle(
3
,DRAW_LINE,
0
,
1
,M30_color);[*]
//============================================================================================
[*] SetIndexBuffer(
4
,M60Buffer);[*] SetIndexLabel(
4
,
"H1 RSI"
);[*] SetIndexStyle(
4
,DRAW_LINE,
0
,
1
,M60_color);[*]
//============================================================================================
[*] SetIndexBuffer(
5
,M240Buffer);[*] SetIndexLabel(
5
,
"H4 RSI"
);[*] SetIndexStyle(
5
,DRAW_LINE,
0
,
1
,M240_color);[*]
//============================================================================================
[*] SetIndexBuffer(
6
,M1440Buffer);[*] SetIndexLabel(
6
,
"D1 RSI"
);[*] SetIndexStyle(
6
,DRAW_LINE,
0
,
1
,M1440_color);[*]
//============================================================================================
[*] SetIndexBuffer(
7
,M10080Buffer);[*] SetIndexLabel(
7
,
"W1 RSI"
);[*] SetIndexStyle(
7
,DRAW_LINE,
0
,
1
,M10080_color);[*]
//============================================================================================
[*][*] IndicatorShortName(
"eXclusive MTF_RSI("
+RSIperiod+
")"
);
//外汇MT4指标窗口左上角显示的“外汇MT4指标名称”
[*][*] return(
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(
"M1RSI"
);
//
[*] ObjectDelete(
"M5RSI"
);[*] ObjectDelete(
"M15RSI"
);[*] ObjectDelete(
"M30RSI"
);[*] ObjectDelete(
"H1RSI"
);[*] ObjectDelete(
"H4RSI"
);[*] ObjectDelete(
"D1RSI"
);[*] ObjectDelete(
"W1RSI"
);[*] ObjectDelete(
"M1ValueRSI"
);[*] ObjectDelete(
"M5ValueRSI"
);[*] ObjectDelete(
"M15ValueRSI"
);[*] ObjectDelete(
"M30ValueRSI"
);[*] ObjectDelete(
"H1ValueRSI"
);[*] ObjectDelete(
"H4ValueRSI"
);[*] ObjectDelete(
"D1ValueRSI"
);[*] ObjectDelete(
"W1ValueRSI"
);[*][*]
//----
[*] return(
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(
0
);[*]}[*]
//============================================================================================
[*]
//============================================================================================
[*]int start1()[*]{[*] datetime TimeArray1[];[*] int i,limit,y=
0
,counted_bars=IndicatorCounted();[*] ArrayCopySeries(TimeArray1,MODE_TIME,Symbol(),
1
);[*] limit=Bars-counted_bars;[*] for(i=
0
,y=
0
;iif (yif(Timereturn(
0
);[*]}[*]
//============================================================================================
[*]int start2()[*]{[*] datetime TimeArray2[];[*] int i,limit,y=
0
,counted_bars=IndicatorCounted();[*] ArrayCopySeries(TimeArray2,MODE_TIME,Symbol(),TF5);[*] limit=Bars-counted_bars;[*] for(i=
0
,y=
0
;iif (yif(Timereturn(
0
);[*]}[*]
//============================================================================================
[*]int start3()[*]{[*] datetime TimeArray3[];[*] int i,limit,y=
0
,counted_bars=IndicatorCounted();[*] ArrayCopySeries(TimeArray3,MODE_TIME,Symbol(),TF15);[*] limit=Bars-counted_bars;[*] for(i=
0
,y=
0
;iif (yif(Timereturn(
0
);[*]}[*]
//============================================================================================
[*]int start4()[*]{[*] datetime TimeArray4[];[*] int i,limit,y=
0
,counted_bars=IndicatorCounted();[*] ArrayCopySeries(TimeArray4,MODE_TIME,Symbol(),TF30);[*] limit=Bars-counted_bars;[*] for(i=
0
,y=
0
;iif (yif(Timereturn(
0
);[*]}[*]
//============================================================================================
[*]int start5()[*]{[*] datetime TimeArray5[];[*] int i,limit,y=
0
,counted_bars=IndicatorCounted();[*] ArrayCopySeries(TimeArray5,MODE_TIME,Symbol(),TF60);[*] limit=Bars-counted_bars;[*] for(i=
0
,y=
0
;iif (yif(Timereturn(
0
);[*]}[*]
//============================================================================================
[*]int start6()[*]{[*] datetime TimeArray6[];[*] int i,limit,y=
0
,counted_bars=IndicatorCounted();[*] ArrayCopySeries(TimeArray6,MODE_TIME,Symbol(),TF240);[*] limit=Bars-counted_bars;[*] for(i=
0
,y=
0
;iif (yif(Timereturn(
0
);[*]}[*]
//============================================================================================
[*]int start7()[*]{[*] datetime TimeArray7[];[*] int i,limit,y=
0
,counted_bars=IndicatorCounted();[*] ArrayCopySeries(TimeArray7,MODE_TIME,Symbol(),TF1440);[*] limit=Bars-counted_bars;[*] for(i=
0
,y=
0
;iif (yif(Timereturn(
0
);[*]}[*]
//============================================================================================
[*]int start8()[*]{[*] datetime TimeArray8[];[*] int i,limit,y=
0
,counted_bars=IndicatorCounted();[*] ArrayCopySeries(TimeArray8,MODE_TIME,Symbol(),TF10080);[*] limit=Bars-counted_bars;[*] for(i=
0
,y=
0
;iif (yif(Timereturn(
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(
"eXclusive MTF_RSI("
+RSIperiod+
")"
),
0
,
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源码。
页:
[1]