下载MetaTrader 5

求助MT4中如何编写瀑布线指标?

要添加评论,请登录注册
还有问题吗?在论坛提问 - 交易者们将会帮助您!
tjlhs
18
tjlhs 2016.06.18 10:38 
如何把瀑布线指标写进MT4系统里,有会编程的高手,能否提供帮助,谢谢!
Xiangdong Guo
3741
Xiangdong Guo 2016.06.18 14:23  
tjlhs:
如何把瀑布线指标写进MT4系统里,有会编程的高手,能否提供帮助,谢谢!

瀑布线是指N条均线叠加么?

如果是的话,根本不需要编程,直接在图表上加载你需要数量的均线,然后保存为模板,想什么时候用就什么时候用。 

Nianfu Li
1551
Nianfu Li 2016.06.20 05:07  
tjlhs:
如何把瀑布线指标写进MT4系统里,有会编程的高手,能否提供帮助,谢谢!

你所说的瀑布线指标是指国内股票软件上常见的PBX指标吗?

代码如下:

PBX1:(EMA(CLOSE,M1)+MA(CLOSE,M1*2)+MA(CLOSE,M1*4))/3;
PBX2:(EMA(CLOSE,M2)+MA(CLOSE,M2*2)+MA(CLOSE,M2*4))/3;
PBX3:(EMA(CLOSE,M3)+MA(CLOSE,M3*2)+MA(CLOSE,M3*4))/3;
PBX4:(EMA(CLOSE,M4)+MA(CLOSE,M4*2)+MA(CLOSE,M4*4))/3;
PBX5:(EMA(CLOSE,M5)+MA(CLOSE,M5*2)+MA(CLOSE,M5*4))/3;
PBX6:(EMA(CLOSE,M6)+MA(CLOSE,M6*2)+MA(CLOSE,M6*4))/3;

tjlhs
18
tjlhs 2016.08.03 15:02  
Nianfu Li:

你所说的瀑布线指标是指国内股票软件上常见的PBX指标吗?

代码如下:

PBX1:(EMA(CLOSE,M1)+MA(CLOSE,M1*2)+MA(CLOSE,M1*4))/3;
PBX2:(EMA(CLOSE,M2)+MA(CLOSE,M2*2)+MA(CLOSE,M2*4))/3;
PBX3:(EMA(CLOSE,M3)+MA(CLOSE,M3*2)+MA(CLOSE,M3*4))/3;
PBX4:(EMA(CLOSE,M4)+MA(CLOSE,M4*2)+MA(CLOSE,M4*4))/3;
PBX5:(EMA(CLOSE,M5)+MA(CLOSE,M5*2)+MA(CLOSE,M5*4))/3;
PBX6:(EMA(CLOSE,M6)+MA(CLOSE,M6*2)+MA(CLOSE,M6*4))/3;

就是这个。MT4添加不进去,我对这个平台编程不熟悉。可否劳烦兄台提供下?
scosun
5
scosun 2016.08.04 09:18  
#include <MovingAverages.mqh>
#property copyright "HANZHEN"
#property link      "http://www.ihanzhen.com"

#property indicator_chart_window

#property indicator_buffers 6
#property indicator_color1 White
#property indicator_color2 Yellow
#property indicator_color3 Orange
#property indicator_color4 OrangeRed
#property indicator_color5 Red
#property indicator_color6 Green

double ExtPX1Buffer[];
double ExtPX2Buffer[];
double ExtPX3Buffer[];
double ExtPX4Buffer[];
double ExtPX5Buffer[];
double ExtPX6Buffer[];

int init()
{
   IndicatorBuffers(6);
   
   SetIndexBuffer(0, ExtPX1Buffer);
   SetIndexBuffer(1, ExtPX2Buffer);
   SetIndexBuffer(2, ExtPX3Buffer);
   SetIndexBuffer(3, ExtPX4Buffer);
   SetIndexBuffer(4, ExtPX5Buffer);
   SetIndexBuffer(5, ExtPX6Buffer);
   
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexStyle(5,DRAW_LINE);

   return(0);
}
//+------------------------------------------------------------------+
//| Stochastic oscillator                                            |
//+------------------------------------------------------------------+
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 counted_bars = IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars > 0)  counted_bars--;
   int limit = Bars - counted_bars;
   if(counted_bars==0) limit-=1+1;

   for(int i=0; i<rates_total; i++){
      ExtPX1Buffer[i]=iMA(NULL,0,4,0,MODE_EMA,PRICE_CLOSE,i)+SimpleMA(i,4*2,close)+SimpleMA(i,4*4,close)/3;
      ExtPX2Buffer[i]=iMA(NULL,0,6,0,MODE_EMA,PRICE_CLOSE,i)+SimpleMA(i,6*2,close)+SimpleMA(i,6*4,close)/3;
      ExtPX3Buffer[i]=iMA(NULL,0,9,0,MODE_EMA,PRICE_CLOSE,i)+SimpleMA(i,9*2,close)+SimpleMA(i,9*4,close)/3;
      ExtPX4Buffer[i]=iMA(NULL,0,13,0,MODE_EMA,PRICE_CLOSE,i)+SimpleMA(i,13*2,close)+SimpleMA(i,13*4,close)/3;
      ExtPX5Buffer[i]=iMA(NULL,0,18,0,MODE_EMA,PRICE_CLOSE,i)+SimpleMA(i,18*2,close)+SimpleMA(i,18*4,close)/3;
      ExtPX6Buffer[i]=iMA(NULL,0,24,0,MODE_EMA,PRICE_CLOSE,i)+SimpleMA(i,24*2,close)+SimpleMA(i,24*4,close)/3;
   }

   return(0);
  }
//+------------------------------------------------------------------+


附加的文件:
pubu.ex4 23 kb
pubu.mq4 5 kb
要添加评论,请登录注册