如何把瀑布线指标写进MT4系统里,有会编程的高手,能否提供帮助,谢谢!
瀑布线是指N条均线叠加么?
如果是的话,根本不需要编程,直接在图表上加载你需要数量的均线,然后保存为模板,想什么时候用就什么时候用。
如何把瀑布线指标写进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;
你所说的瀑布线指标是指国内股票软件上常见的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;
#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); } //+------------------------------------------------------------------+