https://www.myziyuan.com/
- 无敌
- 用MT4自带的源码编译器编译,然后在MT4中,直接添加到图表即可。
- 2021-03-25 03:20:01
- zaijianshaoshi
- //---- indicator settings#property indicator_separate_window#property indicator_buffers 4#property indicator_color1 Lime //bbMacd up#property indicator_color2 Magenta //bbMacd up#property indicator_color3 Blue //Upperband#property indicator_color4 Red //Lowerband//---- indicator parametersextern int FastLen = 12;extern int SlowLen = 26;extern int Length = 10;extern int barsCount = 400;extern double StDv = 2.5;//----int loopbegin;int shift;double zeroline;//---- indicator buffersdouble ExtMapBuffer1[]; // bbMacddouble ExtMapBuffer2[]; // bbMacddouble ExtMapBuffer3[]; // Upperband Linedouble ExtMapBuffer4[]; // Lowerband Line//---- buffersdouble bbMacd[];double Upperband[];double Lowerband[];double avg[];double bbMacdline;double sDev;double mean;double sumSqr;//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int init() {//---- 6 additional buffers are used for counting. IndicatorBuffers(8); //---- drawing settings SetIndexBuffer(0, ExtMapBuffer1); // bbMacd line SetIndexStyle(0, DRAW_ARROW); SetIndexArrow(0, 108); IndicatorDigits(Digits + 1);//---- SetIndexBuffer(1, ExtMapBuffer2); // bbMacd line SetIndexStyle(1, DRAW_ARROW); SetIndexArrow(1, 108); IndicatorDigits(Digits + 1);//---- SetIndexBuffer(2, ExtMapBuffer3); // Upperband line SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 1); IndicatorDigits(Digits + 1);//---- SetIndexBuffer(3, ExtMapBuffer4); // Lowerband line SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 1); IndicatorDigits(Digits + 1);//---- SetIndexBuffer(4, bbMacd); SetIndexBuffer(5, Upperband); SetIndexBuffer(6, Lowerband); SetIndexBuffer(7, avg); //---- name for DataWindow and indicator subwindow label IndicatorShortName("BB MACD(" + FastLen + "," + SlowLen + "," + Length+")"); SetIndexLabel(0, "bbMacd"); SetIndexLabel(1, "Upperband"); SetIndexLabel(2, "Lowerband"); //---- initialization done return(0); }//+------------------------------------------------------------------+//| Custor indicator deinitialization function |//+------------------------------------------------------------------+int deinit() {//---- return(0); }//+------------------------------------------------------------------+//| Custom BB_MACD |//+------------------------------------------------------------------+int start() { int limit; int counted_bars = IndicatorCounted(); if(counted_bars 0) counted_bars--; if (barsCount > 0) limit = MathMin(Bars - counted_bars,barsCount); else limit = Bars - counted_bars;//---- for(int i = 0; i bbMacd[i+1]) ExtMapBuffer2[i] = EMPTY_VALUE; //---- if(bbMacd[i] < bbMacd[i+1]) ExtMapBuffer1[i] = EMPTY_VALUE; }//---- done return(0); }//+------------------------------------------------------------------+
- 2021-02-12 13:12:10
- 十里八乡
- 请教高手,MT4里如何自编指标和交易系统,通过MT4里的MetaEditor进行编写。所谓交易系统、自编指标及模版等,都是程序化了的交易思路,在什么样的情况下,发出什么样的指令、信号,或进行什么样的操作等。首先你得有清晰明确的思路,即你想这些指标、模版、交易系统等怎么去运作、根据什么来运作;然后你得有使你的思路程序化的能力,也就是编程的能力,两者缺一不可。如果你两者都有,打开MetaEditor--创建,根据提示操作,最后输入程序代码就行了。
- 2021-02-12 13:12:10