ไม่มีปัญหานะครับผมใช้อยู่ทุกวันทั้งที่บ้านและ vps เอาไว้ดู m1 เป็นสัญญาณ MDP ครับ
นี้เป็นโค้ด ดัดแปลงมาจาก Heken Ashi ครับ สงสัยติดอะไรจากโค้ดเดิมอยู่เลยมีบั๊ก
//+------------------------------------------------------------------+
//| Heiken Ashi.mq4 |
//| Copyright c 2004, MetaQuotes Software Corp. |
//|
http://www.metaquotes.net |
//+------------------------------------------------------------------+
//| For Heiken Ashi we recommend next chart settings ( press F8 or |
//| select on menu 'Charts'->'Properties...'): |
//| - On 'Color' Tab select 'Black' for 'Line Graph' |
//| - On 'Common' Tab disable 'Chart on Foreground' checkbox and |
//| select 'Line Chart' radiobutton |
//+------------------------------------------------------------------+
#property copyright "Copyright ฉ 2004, MetaQuotes Software Corp."
#property link "
http://www.metaquotes.net"
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Violet
#property indicator_color2 Violet
#property indicator_color3 Magenta
#property indicator_color4 Magenta
#property indicator_color5 Red
#property indicator_color6 Red
//----
extern color color1 = Violet;
extern int width1 = 1;
extern double lenght1 = 10.0;
extern color color2 = Magenta;
extern int width2 = 1;
extern double lenght2 = 15.0;
extern color color3 = Red;
extern int width3 = 1;
extern double lenght3 = 25.0;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
if ( Digits == 5 || Digits == 3 ) { lenght1*=10;lenght2*=10;lenght3*=10; }
//---- indicators
/* SetIndexStyle(0,DRAW_HISTOGRAM, 0, 1, color1);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, 1, color2);
SetIndexBuffer(1, ExtMapBuffer2);
*/
//----
SetIndexDrawBegin(0,10);
SetIndexDrawBegin(1,10);
SetIndexDrawBegin(2,10);
SetIndexDrawBegin(3,10);
SetIndexDrawBegin(4,10);
SetIndexDrawBegin(5,10);
//---- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexBuffer(5,ExtMapBuffer6);
SetIndexStyle(0,DRAW_HISTOGRAM, 0, width1, color1);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, width1, color1);
SetIndexStyle(2,DRAW_HISTOGRAM, 0, width2, color2);
SetIndexStyle(3,DRAW_HISTOGRAM, 0, width2, color2);
SetIndexStyle(4,DRAW_HISTOGRAM, 0, width3, color3);
SetIndexStyle(5,DRAW_HISTOGRAM, 0, width3, color3);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- TODO: add your code here
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double haHigh, haLow;
if(Bars<=10) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
int pos=Bars-ExtCountedBars-1;
while(pos>=0)
{
haHigh=High[pos];
haLow=Low[pos];
ExtMapBuffer1[pos]=haLow;
double lenght=High[pos]- Low[pos];
if ( lenght >= lenght3 * Point)
{
ExtMapBuffer5[pos]=haLow;
ExtMapBuffer6[pos]=haHigh;
ExtMapBuffer1[pos]=EMPTY;
ExtMapBuffer2[pos]=EMPTY;
ExtMapBuffer3[pos]=EMPTY;
ExtMapBuffer4[pos]=EMPTY;
}
else
{
if ( lenght >= lenght2 * Point )
{
ExtMapBuffer3[pos]=haLow;
ExtMapBuffer4[pos]=haHigh;
ExtMapBuffer1[pos]=EMPTY;
ExtMapBuffer2[pos]=EMPTY;
ExtMapBuffer5[pos]=EMPTY;
ExtMapBuffer6[pos]=EMPTY;
}
else
if ( lenght >= lenght1 * Point )
{
ExtMapBuffer1[pos]=haLow;
ExtMapBuffer2[pos]=haHigh;
ExtMapBuffer3[pos]=EMPTY;
ExtMapBuffer4[pos]=EMPTY;
ExtMapBuffer5[pos]=EMPTY;
ExtMapBuffer6[pos]=EMPTY;
}
}
SetIndexBuffer(1, ExtMapBuffer2);
pos--;
}
//----
return(0);
}
//+------------------------------------------------------------------+