有您的持续关注
我们会做得更好

MT4自定义指标 MACDonRSI指标



MACDonRSI指标在附图中显示MACD及RSI.

插入图表效果如下MT4自定义指标MACD RSIMQL4源码如下:

//+------------------------------------------------------------------+
//|                                                           MACDonRSI.mq4 |
//|                                               Ideas by 125808047 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link     "http://www.125808047.com"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 Yellow
#property indicator_level1 70
#property indicator_level2 30
#property indicator_level3 0

//----
extern int MA=5;
extern int RSIperiod=3;
extern int FastEMA=10;
extern int SlowEMA=20;
extern int SignalSMA=5;
//----
double BufRSI[];
double BufMACD[];
double BufSign[];
double BufMA[];

int init()
{
//---- indicator line
    IndicatorBuffers(4);
    SetIndexBuffer(0,BufRSI); SetIndexStyle(0,DRAW_LINE);
    SetIndexBuffer(1,BufMACD); SetIndexStyle(1,DRAW_HISTOGRAM);
    SetIndexBuffer(2,BufSign); SetIndexStyle(2,DRAW_LINE);
    SetIndexBuffer(3,BufMA); SetIndexStyle(3,DRAW_NONE);
    return(0);
}

int start()
{
 int i;
 for(i=0; i<Bars; i++) BufMA[i]=iMA(NULL,0,MA,0, MODE_EMA, PRICE_CLOSE, i);
 for(i=0; i<Bars; i++) BufRSI[i]=iRSIOnArray(BufMA,Bars,RSIperiod,i);
 for(i=0; i<Bars; i++) 
BufMACD[i]=8*(iMAOnArray(BufRSI,Bars,FastEMA,0,MODE_EMA,i)
-iMAOnArray(BufRSI,Bars,SlowEMA,0,MODE_EMA,i));
    for(i=0; i<Bars; i++) BufSign[i]=iMAOnArray(BufMACD,Bars,SignalSMA,0,MODE_SMA,i);
    //----
    return(0);
}
//+------------------------------------------------------------------+

如您喜欢此文章请点下面分享按钮↴峰汇在线 » MT4自定义指标 MACDonRSI指标
上一篇:
下一篇:
分享到:更多 ()