코딩 도움말 - 페이지 329 1...322323324325326327328329330331332333334335336...786 새 코멘트 mj023 2014.08.23 14:25 #3281 이것을 일간 차트에 첨부 해보십시오. 해당 지표를 기반으로 EA를 수행 할 수 있는지 알려주십시오. Mladen Rakic 2014.08.23 16:23 #3282 mj023: 이것을 일간 차트에 첨부 해보십시오. 해당 지표를 기반으로 EA를 수행 할 수 있는지 알려주십시오. 알겠어요 그것은 신호를 가질 가능성이 없는 레이블 기반 표시기입니다(이전 값과 현재 값을 알기 위해). 의미 : 신호를 사용할 수 없으며 EA가 신호를 고유하게 식별할 수 없습니다. 죄송합니다. 이중화 없이는 EA 가능성이 없습니다. Fausto Nunziante Del Gaudio 2014.08.24 11:50 #3283 안녕, 이 코드에 무슨 문제가 있습니까? 소스 표시기에서 icustom 함수 를 사용하여 mtf 표시기를 얻으려고 합니다. 내가 틀렸을 때 볼 수 없습니다. 오류가 어디에 있는지 알려주실 수 있습니까? 이 표시기는 이미 새 빌드용으로 코딩되었지만 mtf 버전은 비표준 시간 프레임에 적합하지 않고 필요하다는 것을 알고 있습니다. 소스 표시기: //+------------------------------------------------------------------+ //| Macd_with_EMA_BDv09_12_22.mq4 | //| Jeff | //| wolfboy@att.net | //+------------------------------------------------------------------+ #property copyright "Jeff" #property link "wolfboy@att.net" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color1 LimeGreen #property indicator_color2 LimeGreen #property indicator_color3 Plum #property indicator_color4 Plum #property indicator_color5 CLR_NONE #property indicator_color6 Black #property indicator_color7 CLR_NONE #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 2 #property indicator_level1 0.0 #property indicator_levelcolor DimGray #property indicator_levelstyle 0 //---- indicator parameters extern int Nbars = 500; extern int FastEMA = 10; extern int SlowEMA = 20; extern int SignalEMA = 1; extern int MAofSignalPer = 7; //---- indicator buffers double green_buffer[]; double DarkGreen_buffer[]; double red_buffer[]; double Maroon_buffer[]; double MacdBuffer[]; double SignalBuffer[]; double MAofSignalBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(7); //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexStyle(6,DRAW_LINE,STYLE_DOT); SetIndexDrawBegin(1,SignalEMA); IndicatorDigits(Digits+1); //---- indicator buffers mapping SetIndexBuffer(0,green_buffer); SetIndexBuffer(1,DarkGreen_buffer); SetIndexBuffer(2,red_buffer); SetIndexBuffer(3,Maroon_buffer); SetIndexBuffer(4,MacdBuffer); SetIndexBuffer(5,SignalBuffer); SetIndexBuffer(6,MAofSignalBuffer); //---- name for DataWindow and indicator subwindow label IndicatorShortName("MACD in color ("+FastEMA+", "+SlowEMA+", "+SignalEMA+", "+MAofSignalPer+")"); SetIndexLabel(4,"MACD in color"); SetIndexLabel(5,"Signal"); SetIndexLabel(6,"MAofSignal"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ int start() { int limit, i; double MACD; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Nbars-counted_bars; //---- macd for(i=0; i<limit; i++) MacdBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)- iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i); //---- signal line for(i=0; i<limit; i++) SignalBuffer=iMAOnArray(MacdBuffer,Bars,SignalEMA,0,MODE_EMA,i); //---- MA of signal for(i=0; i<limit; i++) MAofSignalBuffer=iMAOnArray(SignalBuffer,Bars,MAofSignalPer,0,MODE_EMA,i); for (i = Bars - Max (counted_bars-1, 1); i>=0; i--) { MACD=MacdBuffer; if(MACD>0) { if (MACD>MacdBuffer) { green_buffer = MACD; DarkGreen_buffer = 0; } else { green_buffer = 0; DarkGreen_buffer = MACD; } } else { if (MACD<MacdBuffer) { red_buffer = 0; Maroon_buffer = MACD; } else { red_buffer = MACD; Maroon_buffer = 0; } } } //---- done return(0); } //+------------------------------------------------------------------+ int Max (int val1, int val2) { if (val1 > val2) return(val1); return(val2); } [/CODE] and this is mine: [CODE]//+------------------------------------------------------------------+ //| Macd_with_EMA_BDv09_12_22.mq4 | //| Jeff | //| wolfboy@att.net | //+------------------------------------------------------------------+ #property copyright "Jeff" #property link "wolfboy@att.net" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color1 LimeGreen #property indicator_color2 LimeGreen #property indicator_color3 Plum #property indicator_color4 Plum #property indicator_color5 CLR_NONE #property indicator_color6 Black #property indicator_color7 CLR_NONE #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 2 #property indicator_level1 0.0 #property indicator_levelcolor DimGray #property indicator_levelstyle 0 //---- indicator parameters extern int TimeFrame = 0; extern int Nbars = 500; extern int FastEMA = 10; extern int SlowEMA = 20; extern int SignalEMA = 1; extern int MAofSignalPer = 7; //---- indicator buffers double green_buffer[]; double DarkGreen_buffer[]; double red_buffer[]; double Maroon_buffer[]; double MacdBuffer[]; double SignalBuffer[]; double MAofSignalBuffer[]; string IndicatorFileName; string short_name; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // int init() { //---- indicator buffers mapping SetIndexBuffer(0,green_buffer); SetIndexBuffer(1,DarkGreen_buffer); SetIndexBuffer(2,red_buffer); SetIndexBuffer(3,Maroon_buffer); SetIndexBuffer(4,MacdBuffer); SetIndexBuffer(5,SignalBuffer); SetIndexBuffer(6,MAofSignalBuffer); //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexStyle(6,DRAW_LINE,STYLE_DOT); SetIndexDrawBegin(1,SignalEMA); IndicatorDigits(Digits+1); switch(TimeFrame) { case 1: string TimeFrameStr = "M1" ; break; case 5 : TimeFrameStr = "M5" ; break; case 15 : TimeFrameStr = "M15"; break; case 30 : TimeFrameStr = "M30"; break; case 60 : TimeFrameStr = "H1" ; break; case 240 : TimeFrameStr = "H4" ; break; case 1440 : TimeFrameStr = "D1" ; break; case 10080 : TimeFrameStr = "W1" ; break; case 43200 : TimeFrameStr = "MN1"; break; default : TimeFrameStr = "TF0"; } TimeFrame = MathMax(TimeFrame,Period()); IndicatorFileName = WindowExpertName(); short_name = ("MACD in color MTF ("+TimeFrameStr+")") ; IndicatorShortName(short_name); return(0); } int deinit() { return(0); } int start() { int counted_bars = IndicatorCounted(); int limit, i; if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; limit = Nbars - counted_bars; if (TimeFrame != Period()) { limit = MathMax(limit,TimeFrame/Period()); for(i = 0; i < limit; i++) { int y = iBarShift(NULL,TimeFrame,Time); green_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,0,y); DarkGreen_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,1,y); red_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,2,y); Maroon_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,3,y); MacdBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,4,y); SignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,5,y); MAofSignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,6,y); } return(0); } } Coding help [WARNING CLOSED!] Any newbie Need help with coding Mladen Rakic 2014.08.24 15:45 #3284 thefxpros: 안녕, 이 코드에 무슨 문제가 있습니까? 소스 표시기에서 icustom 함수를 사용하여 mtf 표시기를 얻으려고 합니다. 내가 틀렸을 때 볼 수 없습니다. 오류가 어디에 있는지 알려주실 수 있습니까? 이 표시기는 이미 새 빌드용으로 코딩되었지만 mtf 버전은 비표준 시간 프레임에 적합하지 않고 필요하다는 것을 알고 있습니다. 소스 표시기: //+------------------------------------------------------------------+ //| Macd_with_EMA_BDv09_12_22.mq4 | //| Jeff | //| wolfboy@att.net | //+------------------------------------------------------------------+ #property copyright "Jeff" #property link "wolfboy@att.net" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color1 LimeGreen #property indicator_color2 LimeGreen #property indicator_color3 Plum #property indicator_color4 Plum #property indicator_color5 CLR_NONE #property indicator_color6 Black #property indicator_color7 CLR_NONE #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 2 #property indicator_level1 0.0 #property indicator_levelcolor DimGray #property indicator_levelstyle 0 //---- indicator parameters extern int Nbars = 500; extern int FastEMA = 10; extern int SlowEMA = 20; extern int SignalEMA = 1; extern int MAofSignalPer = 7; //---- indicator buffers double green_buffer[]; double DarkGreen_buffer[]; double red_buffer[]; double Maroon_buffer[]; double MacdBuffer[]; double SignalBuffer[]; double MAofSignalBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(7); //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexStyle(6,DRAW_LINE,STYLE_DOT); SetIndexDrawBegin(1,SignalEMA); IndicatorDigits(Digits+1); //---- indicator buffers mapping SetIndexBuffer(0,green_buffer); SetIndexBuffer(1,DarkGreen_buffer); SetIndexBuffer(2,red_buffer); SetIndexBuffer(3,Maroon_buffer); SetIndexBuffer(4,MacdBuffer); SetIndexBuffer(5,SignalBuffer); SetIndexBuffer(6,MAofSignalBuffer); //---- name for DataWindow and indicator subwindow label IndicatorShortName("MACD in color ("+FastEMA+", "+SlowEMA+", "+SignalEMA+", "+MAofSignalPer+")"); SetIndexLabel(4,"MACD in color"); SetIndexLabel(5,"Signal"); SetIndexLabel(6,"MAofSignal"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ int start() { int limit, i; double MACD; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Nbars-counted_bars; //---- macd for(i=0; i<limit; i++) MacdBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)- iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i); //---- signal line for(i=0; i<limit; i++) SignalBuffer=iMAOnArray(MacdBuffer,Bars,SignalEMA,0,MODE_EMA,i); //---- MA of signal for(i=0; i<limit; i++) MAofSignalBuffer=iMAOnArray(SignalBuffer,Bars,MAofSignalPer,0,MODE_EMA,i); for (i = Bars - Max (counted_bars-1, 1); i>=0; i--) { MACD=MacdBuffer; if(MACD>0) { if (MACD>MacdBuffer) { green_buffer = MACD; DarkGreen_buffer = 0; } else { green_buffer = 0; DarkGreen_buffer = MACD; } } else { if (MACD<MacdBuffer) { red_buffer = 0; Maroon_buffer = MACD; } else { red_buffer = MACD; Maroon_buffer = 0; } } } //---- done return(0); } //+------------------------------------------------------------------+ int Max (int val1, int val2) { if (val1 > val2) return(val1); return(val2); } [/CODE] and this is mine: [CODE]//+------------------------------------------------------------------+ //| Macd_with_EMA_BDv09_12_22.mq4 | //| Jeff | //| wolfboy@att.net | //+------------------------------------------------------------------+ #property copyright "Jeff" #property link "wolfboy@att.net" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color1 LimeGreen #property indicator_color2 LimeGreen #property indicator_color3 Plum #property indicator_color4 Plum #property indicator_color5 CLR_NONE #property indicator_color6 Black #property indicator_color7 CLR_NONE #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 2 #property indicator_level1 0.0 #property indicator_levelcolor DimGray #property indicator_levelstyle 0 //---- indicator parameters extern int TimeFrame = 0; extern int Nbars = 500; extern int FastEMA = 10; extern int SlowEMA = 20; extern int SignalEMA = 1; extern int MAofSignalPer = 7; //---- indicator buffers double green_buffer[]; double DarkGreen_buffer[]; double red_buffer[]; double Maroon_buffer[]; double MacdBuffer[]; double SignalBuffer[]; double MAofSignalBuffer[]; string IndicatorFileName; string short_name; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // int init() { //---- indicator buffers mapping SetIndexBuffer(0,green_buffer); SetIndexBuffer(1,DarkGreen_buffer); SetIndexBuffer(2,red_buffer); SetIndexBuffer(3,Maroon_buffer); SetIndexBuffer(4,MacdBuffer); SetIndexBuffer(5,SignalBuffer); SetIndexBuffer(6,MAofSignalBuffer); //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexStyle(6,DRAW_LINE,STYLE_DOT); SetIndexDrawBegin(1,SignalEMA); IndicatorDigits(Digits+1); switch(TimeFrame) { case 1: string TimeFrameStr = "M1" ; break; case 5 : TimeFrameStr = "M5" ; break; case 15 : TimeFrameStr = "M15"; break; case 30 : TimeFrameStr = "M30"; break; case 60 : TimeFrameStr = "H1" ; break; case 240 : TimeFrameStr = "H4" ; break; case 1440 : TimeFrameStr = "D1" ; break; case 10080 : TimeFrameStr = "W1" ; break; case 43200 : TimeFrameStr = "MN1"; break; default : TimeFrameStr = "TF0"; } TimeFrame = MathMax(TimeFrame,Period()); IndicatorFileName = WindowExpertName(); short_name = ("MACD in color MTF ("+TimeFrameStr+")") ; IndicatorShortName(short_name); return(0); } int deinit() { return(0); } int start() { int counted_bars = IndicatorCounted(); int limit, i; if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; limit = Nbars - counted_bars; if (TimeFrame != Period()) { limit = MathMax(limit,TimeFrame/Period()); for(i = 0; i < limit; i++) { int y = iBarShift(NULL,TimeFrame,Time); green_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,0,y); DarkGreen_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,1,y); red_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,2,y); Maroon_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,3,y); MacdBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,4,y); SignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,5,y); MAofSignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,6,y); } return(0); } } 코드에서 작동해야합니다. 부분 코드이므로 예상과 다른 정확히 무슨 일이 일어나고 있는지 설명할 수 있습니까? Fausto Nunziante Del Gaudio 2014.08.24 15:45 #3285 thefxpros: 안녕, 이 코드에 무슨 문제가 있습니까? 소스 표시기에서 icustom 함수를 사용하여 mtf 표시기를 얻으려고 합니다. 내가 틀렸을 때 볼 수 없습니다. 오류가 어디에 있는지 알려주실 수 있습니까? 이 표시기는 이미 새 빌드용으로 코딩되었지만 mtf 버전은 비표준 시간 프레임에 적합하지 않고 필요하다는 것을 알고 있습니다. 소스 표시기: //+------------------------------------------------------------------+ //| Macd_with_EMA_BDv09_12_22.mq4 | //| Jeff | //| wolfboy@att.net | //+------------------------------------------------------------------+ #property copyright "Jeff" #property link "wolfboy@att.net" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color1 LimeGreen #property indicator_color2 LimeGreen #property indicator_color3 Plum #property indicator_color4 Plum #property indicator_color5 CLR_NONE #property indicator_color6 Black #property indicator_color7 CLR_NONE #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 2 #property indicator_level1 0.0 #property indicator_levelcolor DimGray #property indicator_levelstyle 0 //---- indicator parameters extern int Nbars = 500; extern int FastEMA = 10; extern int SlowEMA = 20; extern int SignalEMA = 1; extern int MAofSignalPer = 7; //---- indicator buffers double green_buffer[]; double DarkGreen_buffer[]; double red_buffer[]; double Maroon_buffer[]; double MacdBuffer[]; double SignalBuffer[]; double MAofSignalBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(7); //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexStyle(6,DRAW_LINE,STYLE_DOT); SetIndexDrawBegin(1,SignalEMA); IndicatorDigits(Digits+1); //---- indicator buffers mapping SetIndexBuffer(0,green_buffer); SetIndexBuffer(1,DarkGreen_buffer); SetIndexBuffer(2,red_buffer); SetIndexBuffer(3,Maroon_buffer); SetIndexBuffer(4,MacdBuffer); SetIndexBuffer(5,SignalBuffer); SetIndexBuffer(6,MAofSignalBuffer); //---- name for DataWindow and indicator subwindow label IndicatorShortName("MACD in color ("+FastEMA+", "+SlowEMA+", "+SignalEMA+", "+MAofSignalPer+")"); SetIndexLabel(4,"MACD in color"); SetIndexLabel(5,"Signal"); SetIndexLabel(6,"MAofSignal"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ int start() { int limit, i; double MACD; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Nbars-counted_bars; //---- macd for(i=0; i<limit; i++) MacdBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)- iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i); //---- signal line for(i=0; i<limit; i++) SignalBuffer=iMAOnArray(MacdBuffer,Bars,SignalEMA,0,MODE_EMA,i); //---- MA of signal for(i=0; i<limit; i++) MAofSignalBuffer=iMAOnArray(SignalBuffer,Bars,MAofSignalPer,0,MODE_EMA,i); for (i = Bars - Max (counted_bars-1, 1); i>=0; i--) { MACD=MacdBuffer; if(MACD>0) { if (MACD>MacdBuffer) { green_buffer = MACD; DarkGreen_buffer = 0; } else { green_buffer = 0; DarkGreen_buffer = MACD; } } else { if (MACD<MacdBuffer) { red_buffer = 0; Maroon_buffer = MACD; } else { red_buffer = MACD; Maroon_buffer = 0; } } } //---- done return(0); } //+------------------------------------------------------------------+ int Max (int val1, int val2) { if (val1 > val2) return(val1); return(val2); } [/CODE] and this is mine: [CODE]//+------------------------------------------------------------------+ //| Macd_with_EMA_BDv09_12_22.mq4 | //| Jeff | //| wolfboy@att.net | //+------------------------------------------------------------------+ #property copyright "Jeff" #property link "wolfboy@att.net" #property indicator_separate_window #property indicator_buffers 7 #property indicator_color1 LimeGreen #property indicator_color2 LimeGreen #property indicator_color3 Plum #property indicator_color4 Plum #property indicator_color5 CLR_NONE #property indicator_color6 Black #property indicator_color7 CLR_NONE #property indicator_width1 2 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 2 #property indicator_level1 0.0 #property indicator_levelcolor DimGray #property indicator_levelstyle 0 //---- indicator parameters extern int TimeFrame = 0; extern int Nbars = 500; extern int FastEMA = 10; extern int SlowEMA = 20; extern int SignalEMA = 1; extern int MAofSignalPer = 7; //---- indicator buffers double green_buffer[]; double DarkGreen_buffer[]; double red_buffer[]; double Maroon_buffer[]; double MacdBuffer[]; double SignalBuffer[]; double MAofSignalBuffer[]; string IndicatorFileName; string short_name; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ // // // // // int init() { //---- indicator buffers mapping SetIndexBuffer(0,green_buffer); SetIndexBuffer(1,DarkGreen_buffer); SetIndexBuffer(2,red_buffer); SetIndexBuffer(3,Maroon_buffer); SetIndexBuffer(4,MacdBuffer); SetIndexBuffer(5,SignalBuffer); SetIndexBuffer(6,MAofSignalBuffer); //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(4,DRAW_NONE); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID); SetIndexStyle(6,DRAW_LINE,STYLE_DOT); SetIndexDrawBegin(1,SignalEMA); IndicatorDigits(Digits+1); switch(TimeFrame) { case 1: string TimeFrameStr = "M1" ; break; case 5 : TimeFrameStr = "M5" ; break; case 15 : TimeFrameStr = "M15"; break; case 30 : TimeFrameStr = "M30"; break; case 60 : TimeFrameStr = "H1" ; break; case 240 : TimeFrameStr = "H4" ; break; case 1440 : TimeFrameStr = "D1" ; break; case 10080 : TimeFrameStr = "W1" ; break; case 43200 : TimeFrameStr = "MN1"; break; default : TimeFrameStr = "TF0"; } TimeFrame = MathMax(TimeFrame,Period()); IndicatorFileName = WindowExpertName(); short_name = ("MACD in color MTF ("+TimeFrameStr+")") ; IndicatorShortName(short_name); return(0); } int deinit() { return(0); } int start() { int counted_bars = IndicatorCounted(); int limit, i; if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; limit = Nbars - counted_bars; if (TimeFrame != Period()) { limit = MathMax(limit,TimeFrame/Period()); for(i = 0; i < limit; i++) { int y = iBarShift(NULL,TimeFrame,Time); green_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,0,y); DarkGreen_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,1,y); red_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,2,y); Maroon_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,3,y); MacdBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,4,y); SignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,5,y); MAofSignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,6,y); } return(0); } } 방금 해결했습니다. Fausto Nunziante Del Gaudio 2014.08.25 08:29 #3286 음 다른 도움이 필요합니다. 소스 표시기: 단계 차트 연령 2 MTF 내 지표 : 단계 차트 연령 2 MTF 양초 나는 잘하고 있다고 생각하지만 차트에 플롯 할 때 내 표시기가 아무 것도 표시하지 않습니다. 소스 표시기 추세 버퍼에 따라 다르지만 계속하는 방법을 모르겠습니다. step_chart_age_2_mtf_candles.mq4 step_chart_age_2_mtf.mq4 파일: step_chart_age_2_mtf_candles.mq4 5 kb step_chart_age_2_mtf.mq4 9 kb Mladen Rakic 2014.08.25 11:08 #3287 thefxpros: 음 다른 도움이 필요합니다. 소스 표시기: 단계 차트 연령 2 MTF 내 지표 : 단계 차트 연령 2 MTF 양초 나는 잘하고 있다고 생각하지만 차트에 플롯 할 때 내 표시기가 아무 것도 표시하지 않습니다. 소스 표시기 추세 버퍼에 따라 다르지만 계속하는 방법을 모르겠습니다. step_chart_age_2_mtf_candles.mq4 step_chart_age_2_mtf.mq4 에프엑스프로 여기 있습니다: step_chart_age_2_mtf_candles_1.mq4 파일: step_chart_age_2_mtf_candles_1.mq4 5 kb Fausto Nunziante Del Gaudio 2014.08.25 11:18 #3288 mladen: fxpros 여기 있습니다: step_chart_age_2_mtf_candles_1.mq4 감사해요, 하지만 여전히 문제가 있습니다 파일: cattura_1.jpg 90 kb Mladen Rakic 2014.08.25 11:25 #3289 thefxpros: 감사해요, 하지만 여전히 문제가 있습니다 추세 조건을 잘못 확인 하고 있습니다. 추세 > 0 및 추세 < 0이어야 하며 추세 == 1 및 추세 == -1이 아니어야 합니다. 파일: step_ma_bars.gif 65 kb AZRUL FYZEE AZMI 2014.08.25 11:54 #3290 당신은 이것을 시도 할 수 있습니다 .... 도움이되기를 바랍니다 파일: captureaa.jpg 69 kb step_chart_age_2_mtf-1.01.mq4 9 kb step_chart_age_2_mtf_candles-1.01.mq4 9 kb 1...322323324325326327328329330331332333334335336...786 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
이것을 일간 차트에 첨부 해보십시오. 해당 지표를 기반으로 EA를 수행 할 수 있는지 알려주십시오.
이것을 일간 차트에 첨부 해보십시오. 해당 지표를 기반으로 EA를 수행 할 수 있는지 알려주십시오.
알겠어요
그것은 신호를 가질 가능성이 없는 레이블 기반 표시기입니다(이전 값과 현재 값을 알기 위해). 의미 : 신호를 사용할 수 없으며 EA가 신호를 고유하게 식별할 수 없습니다. 죄송합니다. 이중화 없이는 EA 가능성이 없습니다.
안녕,
이 코드에 무슨 문제가 있습니까? 소스 표시기에서 icustom 함수 를 사용하여 mtf 표시기를 얻으려고 합니다. 내가 틀렸을 때 볼 수 없습니다. 오류가 어디에 있는지 알려주실 수 있습니까?
이 표시기는 이미 새 빌드용으로 코딩되었지만 mtf 버전은 비표준 시간 프레임에 적합하지 않고 필요하다는 것을 알고 있습니다.
소스 표시기:
//| Macd_with_EMA_BDv09_12_22.mq4 |
//| Jeff |
//| wolfboy@att.net |
//+------------------------------------------------------------------+
#property copyright "Jeff"
#property link "wolfboy@att.net"
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 LimeGreen
#property indicator_color2 LimeGreen
#property indicator_color3 Plum
#property indicator_color4 Plum
#property indicator_color5 CLR_NONE
#property indicator_color6 Black
#property indicator_color7 CLR_NONE
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 1
#property indicator_width6 1
#property indicator_width7 2
#property indicator_level1 0.0
#property indicator_levelcolor DimGray
#property indicator_levelstyle 0
//---- indicator parameters
extern int Nbars = 500;
extern int FastEMA = 10;
extern int SlowEMA = 20;
extern int SignalEMA = 1;
extern int MAofSignalPer = 7;
//---- indicator buffers
double green_buffer[];
double DarkGreen_buffer[];
double red_buffer[];
double Maroon_buffer[];
double MacdBuffer[];
double SignalBuffer[];
double MAofSignalBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(7);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(4,DRAW_NONE);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexDrawBegin(1,SignalEMA);
IndicatorDigits(Digits+1);
//---- indicator buffers mapping
SetIndexBuffer(0,green_buffer);
SetIndexBuffer(1,DarkGreen_buffer);
SetIndexBuffer(2,red_buffer);
SetIndexBuffer(3,Maroon_buffer);
SetIndexBuffer(4,MacdBuffer);
SetIndexBuffer(5,SignalBuffer);
SetIndexBuffer(6,MAofSignalBuffer);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("MACD in color ("+FastEMA+", "+SlowEMA+", "+SignalEMA+", "+MAofSignalPer+")");
SetIndexLabel(4,"MACD in color");
SetIndexLabel(5,"Signal");
SetIndexLabel(6,"MAofSignal");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit, i;
double MACD;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Nbars-counted_bars;
//---- macd
for(i=0; i<limit; i++)
MacdBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-
iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line
for(i=0; i<limit; i++)
SignalBuffer=iMAOnArray(MacdBuffer,Bars,SignalEMA,0,MODE_EMA,i);
//---- MA of signal
for(i=0; i<limit; i++)
MAofSignalBuffer=iMAOnArray(SignalBuffer,Bars,MAofSignalPer,0,MODE_EMA,i);
for (i = Bars - Max (counted_bars-1, 1); i>=0; i--)
{
MACD=MacdBuffer;
if(MACD>0)
{
if (MACD>MacdBuffer)
{
green_buffer = MACD;
DarkGreen_buffer = 0;
}
else
{
green_buffer = 0;
DarkGreen_buffer = MACD;
}
}
else
{
if (MACD<MacdBuffer)
{
red_buffer = 0;
Maroon_buffer = MACD;
}
else
{
red_buffer = MACD;
Maroon_buffer = 0;
}
}
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
int Max (int val1, int val2) {
if (val1 > val2) return(val1);
return(val2);
}
[/CODE]
and this is mine:
[CODE]//+------------------------------------------------------------------+
//| Macd_with_EMA_BDv09_12_22.mq4 |
//| Jeff |
//| wolfboy@att.net |
//+------------------------------------------------------------------+
#property copyright "Jeff"
#property link "wolfboy@att.net"
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 LimeGreen
#property indicator_color2 LimeGreen
#property indicator_color3 Plum
#property indicator_color4 Plum
#property indicator_color5 CLR_NONE
#property indicator_color6 Black
#property indicator_color7 CLR_NONE
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 1
#property indicator_width6 1
#property indicator_width7 2
#property indicator_level1 0.0
#property indicator_levelcolor DimGray
#property indicator_levelstyle 0
//---- indicator parameters
extern int TimeFrame = 0;
extern int Nbars = 500;
extern int FastEMA = 10;
extern int SlowEMA = 20;
extern int SignalEMA = 1;
extern int MAofSignalPer = 7;
//---- indicator buffers
double green_buffer[];
double DarkGreen_buffer[];
double red_buffer[];
double Maroon_buffer[];
double MacdBuffer[];
double SignalBuffer[];
double MAofSignalBuffer[];
string IndicatorFileName;
string short_name;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
//---- indicator buffers mapping
SetIndexBuffer(0,green_buffer);
SetIndexBuffer(1,DarkGreen_buffer);
SetIndexBuffer(2,red_buffer);
SetIndexBuffer(3,Maroon_buffer);
SetIndexBuffer(4,MacdBuffer);
SetIndexBuffer(5,SignalBuffer);
SetIndexBuffer(6,MAofSignalBuffer);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(4,DRAW_NONE);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexDrawBegin(1,SignalEMA);
IndicatorDigits(Digits+1);
switch(TimeFrame)
{
case 1: string TimeFrameStr = "M1" ; break;
case 5 : TimeFrameStr = "M5" ; break;
case 15 : TimeFrameStr = "M15"; break;
case 30 : TimeFrameStr = "M30"; break;
case 60 : TimeFrameStr = "H1" ; break;
case 240 : TimeFrameStr = "H4" ; break;
case 1440 : TimeFrameStr = "D1" ; break;
case 10080 : TimeFrameStr = "W1" ; break;
case 43200 : TimeFrameStr = "MN1"; break;
default : TimeFrameStr = "TF0";
}
TimeFrame = MathMax(TimeFrame,Period());
IndicatorFileName = WindowExpertName();
short_name = ("MACD in color MTF ("+TimeFrameStr+")") ;
IndicatorShortName(short_name);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int counted_bars = IndicatorCounted();
int limit, i;
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
limit = Nbars - counted_bars;
if (TimeFrame != Period())
{
limit = MathMax(limit,TimeFrame/Period());
for(i = 0; i < limit; i++)
{
int y = iBarShift(NULL,TimeFrame,Time);
green_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,0,y);
DarkGreen_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,1,y);
red_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,2,y);
Maroon_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,3,y);
MacdBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,4,y);
SignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,5,y);
MAofSignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,6,y);
}
return(0);
}
}안녕,
이 코드에 무슨 문제가 있습니까? 소스 표시기에서 icustom 함수를 사용하여 mtf 표시기를 얻으려고 합니다. 내가 틀렸을 때 볼 수 없습니다. 오류가 어디에 있는지 알려주실 수 있습니까?
이 표시기는 이미 새 빌드용으로 코딩되었지만 mtf 버전은 비표준 시간 프레임에 적합하지 않고 필요하다는 것을 알고 있습니다.
소스 표시기:
//| Macd_with_EMA_BDv09_12_22.mq4 |
//| Jeff |
//| wolfboy@att.net |
//+------------------------------------------------------------------+
#property copyright "Jeff"
#property link "wolfboy@att.net"
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 LimeGreen
#property indicator_color2 LimeGreen
#property indicator_color3 Plum
#property indicator_color4 Plum
#property indicator_color5 CLR_NONE
#property indicator_color6 Black
#property indicator_color7 CLR_NONE
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 1
#property indicator_width6 1
#property indicator_width7 2
#property indicator_level1 0.0
#property indicator_levelcolor DimGray
#property indicator_levelstyle 0
//---- indicator parameters
extern int Nbars = 500;
extern int FastEMA = 10;
extern int SlowEMA = 20;
extern int SignalEMA = 1;
extern int MAofSignalPer = 7;
//---- indicator buffers
double green_buffer[];
double DarkGreen_buffer[];
double red_buffer[];
double Maroon_buffer[];
double MacdBuffer[];
double SignalBuffer[];
double MAofSignalBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(7);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(4,DRAW_NONE);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexDrawBegin(1,SignalEMA);
IndicatorDigits(Digits+1);
//---- indicator buffers mapping
SetIndexBuffer(0,green_buffer);
SetIndexBuffer(1,DarkGreen_buffer);
SetIndexBuffer(2,red_buffer);
SetIndexBuffer(3,Maroon_buffer);
SetIndexBuffer(4,MacdBuffer);
SetIndexBuffer(5,SignalBuffer);
SetIndexBuffer(6,MAofSignalBuffer);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("MACD in color ("+FastEMA+", "+SlowEMA+", "+SignalEMA+", "+MAofSignalPer+")");
SetIndexLabel(4,"MACD in color");
SetIndexLabel(5,"Signal");
SetIndexLabel(6,"MAofSignal");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit, i;
double MACD;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Nbars-counted_bars;
//---- macd
for(i=0; i<limit; i++)
MacdBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-
iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line
for(i=0; i<limit; i++)
SignalBuffer=iMAOnArray(MacdBuffer,Bars,SignalEMA,0,MODE_EMA,i);
//---- MA of signal
for(i=0; i<limit; i++)
MAofSignalBuffer=iMAOnArray(SignalBuffer,Bars,MAofSignalPer,0,MODE_EMA,i);
for (i = Bars - Max (counted_bars-1, 1); i>=0; i--)
{
MACD=MacdBuffer;
if(MACD>0)
{
if (MACD>MacdBuffer)
{
green_buffer = MACD;
DarkGreen_buffer = 0;
}
else
{
green_buffer = 0;
DarkGreen_buffer = MACD;
}
}
else
{
if (MACD<MacdBuffer)
{
red_buffer = 0;
Maroon_buffer = MACD;
}
else
{
red_buffer = MACD;
Maroon_buffer = 0;
}
}
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
int Max (int val1, int val2) {
if (val1 > val2) return(val1);
return(val2);
}
[/CODE]
and this is mine:
[CODE]//+------------------------------------------------------------------+
//| Macd_with_EMA_BDv09_12_22.mq4 |
//| Jeff |
//| wolfboy@att.net |
//+------------------------------------------------------------------+
#property copyright "Jeff"
#property link "wolfboy@att.net"
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 LimeGreen
#property indicator_color2 LimeGreen
#property indicator_color3 Plum
#property indicator_color4 Plum
#property indicator_color5 CLR_NONE
#property indicator_color6 Black
#property indicator_color7 CLR_NONE
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 1
#property indicator_width6 1
#property indicator_width7 2
#property indicator_level1 0.0
#property indicator_levelcolor DimGray
#property indicator_levelstyle 0
//---- indicator parameters
extern int TimeFrame = 0;
extern int Nbars = 500;
extern int FastEMA = 10;
extern int SlowEMA = 20;
extern int SignalEMA = 1;
extern int MAofSignalPer = 7;
//---- indicator buffers
double green_buffer[];
double DarkGreen_buffer[];
double red_buffer[];
double Maroon_buffer[];
double MacdBuffer[];
double SignalBuffer[];
double MAofSignalBuffer[];
string IndicatorFileName;
string short_name;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
//---- indicator buffers mapping
SetIndexBuffer(0,green_buffer);
SetIndexBuffer(1,DarkGreen_buffer);
SetIndexBuffer(2,red_buffer);
SetIndexBuffer(3,Maroon_buffer);
SetIndexBuffer(4,MacdBuffer);
SetIndexBuffer(5,SignalBuffer);
SetIndexBuffer(6,MAofSignalBuffer);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(4,DRAW_NONE);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexDrawBegin(1,SignalEMA);
IndicatorDigits(Digits+1);
switch(TimeFrame)
{
case 1: string TimeFrameStr = "M1" ; break;
case 5 : TimeFrameStr = "M5" ; break;
case 15 : TimeFrameStr = "M15"; break;
case 30 : TimeFrameStr = "M30"; break;
case 60 : TimeFrameStr = "H1" ; break;
case 240 : TimeFrameStr = "H4" ; break;
case 1440 : TimeFrameStr = "D1" ; break;
case 10080 : TimeFrameStr = "W1" ; break;
case 43200 : TimeFrameStr = "MN1"; break;
default : TimeFrameStr = "TF0";
}
TimeFrame = MathMax(TimeFrame,Period());
IndicatorFileName = WindowExpertName();
short_name = ("MACD in color MTF ("+TimeFrameStr+")") ;
IndicatorShortName(short_name);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int counted_bars = IndicatorCounted();
int limit, i;
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
limit = Nbars - counted_bars;
if (TimeFrame != Period())
{
limit = MathMax(limit,TimeFrame/Period());
for(i = 0; i < limit; i++)
{
int y = iBarShift(NULL,TimeFrame,Time);
green_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,0,y);
DarkGreen_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,1,y);
red_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,2,y);
Maroon_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,3,y);
MacdBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,4,y);
SignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,5,y);
MAofSignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,6,y);
}
return(0);
}
}코드에서 작동해야합니다.
부분 코드이므로 예상과 다른 정확히 무슨 일이 일어나고 있는지 설명할 수 있습니까?
안녕,
이 코드에 무슨 문제가 있습니까? 소스 표시기에서 icustom 함수를 사용하여 mtf 표시기를 얻으려고 합니다. 내가 틀렸을 때 볼 수 없습니다. 오류가 어디에 있는지 알려주실 수 있습니까?
이 표시기는 이미 새 빌드용으로 코딩되었지만 mtf 버전은 비표준 시간 프레임에 적합하지 않고 필요하다는 것을 알고 있습니다.
소스 표시기:
//| Macd_with_EMA_BDv09_12_22.mq4 |
//| Jeff |
//| wolfboy@att.net |
//+------------------------------------------------------------------+
#property copyright "Jeff"
#property link "wolfboy@att.net"
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 LimeGreen
#property indicator_color2 LimeGreen
#property indicator_color3 Plum
#property indicator_color4 Plum
#property indicator_color5 CLR_NONE
#property indicator_color6 Black
#property indicator_color7 CLR_NONE
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 1
#property indicator_width6 1
#property indicator_width7 2
#property indicator_level1 0.0
#property indicator_levelcolor DimGray
#property indicator_levelstyle 0
//---- indicator parameters
extern int Nbars = 500;
extern int FastEMA = 10;
extern int SlowEMA = 20;
extern int SignalEMA = 1;
extern int MAofSignalPer = 7;
//---- indicator buffers
double green_buffer[];
double DarkGreen_buffer[];
double red_buffer[];
double Maroon_buffer[];
double MacdBuffer[];
double SignalBuffer[];
double MAofSignalBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
IndicatorBuffers(7);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(4,DRAW_NONE);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexDrawBegin(1,SignalEMA);
IndicatorDigits(Digits+1);
//---- indicator buffers mapping
SetIndexBuffer(0,green_buffer);
SetIndexBuffer(1,DarkGreen_buffer);
SetIndexBuffer(2,red_buffer);
SetIndexBuffer(3,Maroon_buffer);
SetIndexBuffer(4,MacdBuffer);
SetIndexBuffer(5,SignalBuffer);
SetIndexBuffer(6,MAofSignalBuffer);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("MACD in color ("+FastEMA+", "+SlowEMA+", "+SignalEMA+", "+MAofSignalPer+")");
SetIndexLabel(4,"MACD in color");
SetIndexLabel(5,"Signal");
SetIndexLabel(6,"MAofSignal");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence |
//+------------------------------------------------------------------+
int start()
{
int limit, i;
double MACD;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Nbars-counted_bars;
//---- macd
for(i=0; i<limit; i++)
MacdBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-
iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//---- signal line
for(i=0; i<limit; i++)
SignalBuffer=iMAOnArray(MacdBuffer,Bars,SignalEMA,0,MODE_EMA,i);
//---- MA of signal
for(i=0; i<limit; i++)
MAofSignalBuffer=iMAOnArray(SignalBuffer,Bars,MAofSignalPer,0,MODE_EMA,i);
for (i = Bars - Max (counted_bars-1, 1); i>=0; i--)
{
MACD=MacdBuffer;
if(MACD>0)
{
if (MACD>MacdBuffer)
{
green_buffer = MACD;
DarkGreen_buffer = 0;
}
else
{
green_buffer = 0;
DarkGreen_buffer = MACD;
}
}
else
{
if (MACD<MacdBuffer)
{
red_buffer = 0;
Maroon_buffer = MACD;
}
else
{
red_buffer = MACD;
Maroon_buffer = 0;
}
}
}
//---- done
return(0);
}
//+------------------------------------------------------------------+
int Max (int val1, int val2) {
if (val1 > val2) return(val1);
return(val2);
}
[/CODE]
and this is mine:
[CODE]//+------------------------------------------------------------------+
//| Macd_with_EMA_BDv09_12_22.mq4 |
//| Jeff |
//| wolfboy@att.net |
//+------------------------------------------------------------------+
#property copyright "Jeff"
#property link "wolfboy@att.net"
#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 LimeGreen
#property indicator_color2 LimeGreen
#property indicator_color3 Plum
#property indicator_color4 Plum
#property indicator_color5 CLR_NONE
#property indicator_color6 Black
#property indicator_color7 CLR_NONE
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 1
#property indicator_width6 1
#property indicator_width7 2
#property indicator_level1 0.0
#property indicator_levelcolor DimGray
#property indicator_levelstyle 0
//---- indicator parameters
extern int TimeFrame = 0;
extern int Nbars = 500;
extern int FastEMA = 10;
extern int SlowEMA = 20;
extern int SignalEMA = 1;
extern int MAofSignalPer = 7;
//---- indicator buffers
double green_buffer[];
double DarkGreen_buffer[];
double red_buffer[];
double Maroon_buffer[];
double MacdBuffer[];
double SignalBuffer[];
double MAofSignalBuffer[];
string IndicatorFileName;
string short_name;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
//---- indicator buffers mapping
SetIndexBuffer(0,green_buffer);
SetIndexBuffer(1,DarkGreen_buffer);
SetIndexBuffer(2,red_buffer);
SetIndexBuffer(3,Maroon_buffer);
SetIndexBuffer(4,MacdBuffer);
SetIndexBuffer(5,SignalBuffer);
SetIndexBuffer(6,MAofSignalBuffer);
//---- drawing settings
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID);
SetIndexStyle(4,DRAW_NONE);
SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexDrawBegin(1,SignalEMA);
IndicatorDigits(Digits+1);
switch(TimeFrame)
{
case 1: string TimeFrameStr = "M1" ; break;
case 5 : TimeFrameStr = "M5" ; break;
case 15 : TimeFrameStr = "M15"; break;
case 30 : TimeFrameStr = "M30"; break;
case 60 : TimeFrameStr = "H1" ; break;
case 240 : TimeFrameStr = "H4" ; break;
case 1440 : TimeFrameStr = "D1" ; break;
case 10080 : TimeFrameStr = "W1" ; break;
case 43200 : TimeFrameStr = "MN1"; break;
default : TimeFrameStr = "TF0";
}
TimeFrame = MathMax(TimeFrame,Period());
IndicatorFileName = WindowExpertName();
short_name = ("MACD in color MTF ("+TimeFrameStr+")") ;
IndicatorShortName(short_name);
return(0);
}
int deinit()
{
return(0);
}
int start()
{
int counted_bars = IndicatorCounted();
int limit, i;
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
limit = Nbars - counted_bars;
if (TimeFrame != Period())
{
limit = MathMax(limit,TimeFrame/Period());
for(i = 0; i < limit; i++)
{
int y = iBarShift(NULL,TimeFrame,Time);
green_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,0,y);
DarkGreen_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,1,y);
red_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,2,y);
Maroon_buffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,3,y);
MacdBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,4,y);
SignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,5,y);
MAofSignalBuffer = iCustom(NULL,TimeFrame,"MACD in color",Nbars,FastEMA,SlowEMA,SignalEMA,MAofSignalPer,6,y);
}
return(0);
}
}방금 해결했습니다.
음
다른 도움이 필요합니다.
소스 표시기: 단계 차트 연령 2 MTF
내 지표 : 단계 차트 연령 2 MTF 양초
나는 잘하고 있다고 생각하지만 차트에 플롯 할 때 내 표시기가 아무 것도 표시하지 않습니다. 소스 표시기 추세 버퍼에 따라 다르지만 계속하는 방법을 모르겠습니다.
step_chart_age_2_mtf_candles.mq4
step_chart_age_2_mtf.mq4
음
다른 도움이 필요합니다.
소스 표시기: 단계 차트 연령 2 MTF
내 지표 : 단계 차트 연령 2 MTF 양초
나는 잘하고 있다고 생각하지만 차트에 플롯 할 때 내 표시기가 아무 것도 표시하지 않습니다. 소스 표시기 추세 버퍼에 따라 다르지만 계속하는 방법을 모르겠습니다.
step_chart_age_2_mtf_candles.mq4
step_chart_age_2_mtf.mq4에프엑스프로
여기 있습니다: step_chart_age_2_mtf_candles_1.mq4
fxpros 여기 있습니다: step_chart_age_2_mtf_candles_1.mq4
감사해요,
하지만 여전히 문제가 있습니다
감사해요,
하지만 여전히 문제가 있습니다
추세 조건을 잘못 확인 하고 있습니다.
추세 > 0 및 추세 < 0이어야 하며 추세 == 1 및 추세 == -1이 아니어야 합니다.
당신은 이것을 시도 할 수 있습니다 .... 도움이되기를 바랍니다