Current location - Loan Platform Complete Network - Foreign exchange account opening - What do you mean by foreign exchange gold bars?
What do you mean by foreign exchange gold bars?
//+ - +

//| MACD_ColorHist_Alert.mq4 |

//| Copyright? In 2006, Robert Hill |

//| |

//+ - +

# Property Copyright "Copyright? In 2006, Robert Hill

//-indicator settings

# Attribute Indicator _ Separate _ Window

# Attribute Indicator _ Buffer 4

# Attribute indicator _color 1 light green

# Attribute Indicator _ Color 2 Red

# Attribute Indicator _ Color 3 Green

# Attribute Indicator _ Color 4 Red

//-Indicator parameters

extern bool SoundON = true

extern bool EmailON = false

extern int FastEMA = 12;

extern int SlowEMA = 26

extern int signals ma = 9;

//-indicator buffer

double ind _ buffer 1[];

double ind _ buffer 2[];

double histogram buffer up[];

double histogram buffer down[];

int flag val 1 = 0;

int flag val 2 = 0;

//-Variable

//+ - +

//| Customize the indicator initialization function |

//+ - +

int init()

{

//-Drawing Settings

//indicator buffers(3);

indicator DIGITS(market info(Symbol()、MODE _ DIGITS)+ 1);

SetIndexStyle(0,DRAW_LINE,STYLE _ SOLID);

SetIndexBuffer(0,ind _ buffer 1);

SetIndexDrawBegin(0,slow EMA);

SetIndexStyle( 1,DRAW_LINE,STYLE _ DOT);

SetIndexBuffer( 1,ind _ buffer 2);

SetIndexDrawBegin( 1,signals ma);

SetIndexStyle(2,DRAW_HISTOGRAM,STYLE _ SOLID);

SetIndexBuffer(2,HistogramBufferUp);

SetIndexStyle(3,DRAW_HISTOGRAM,STYLE _ SOLID);

SetIndexBuffer(3,HistogramBufferDown);

// SetIndexDrawBegin(2,slow EMA+signals ma);

//-Names of data window and indicator child window labels

indicator short name(" MACD("+FastEMA+","+SlowEMA+","+signals ma+");

SetIndexLabel(0,“MACD”);

SetIndexLabel( 1, "signal");

SetIndexLabel(2, "histogram");

//-Initialization completed

return(0);

}

//+ - +

//| Moving Average Convergence/Divergence |

//+ - +

int start()

{

Int restriction;

Double temperature;

int counted _ bars = indicator counted();

//-Check for possible errors

if(counted _ bars & lt; 0) return (-1);

//-The last counted bar will be recalculated.

if(counted _ bars & gt; 0)counted _ bars-;

limit = Bars-counted _ Bars;

//-macd is included in 1-st buffer.

for(int I = 0; I< limit; i++)

ind_buffer 1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,I);

//-Signal lines counted in the second buffer

for(I = 0; I< limit; i++)

ind _ buffer 2[I]= iMAOnArray(ind _ buffer 1,Bars,SignalSMA,0,MODE_SMA,I);

//ind _ buffer 2[I]= alpha * ind _ buffer 1[I]+alpha _ 1 * ind _ buffer 2[I+ 1];

for(I = 0; I< limit; i++)

{

HistogramBufferUp[I]= 0;

HistogramBufferDown[I]= 0;

temp = ind _ buffer 1[I]-ind _ buffer 2[I];

if(temp & gt; = 0)

HistogramBufferUp[I]= temp;

other

HistogramBufferDown[I]= temp;

if (i == 1)

{

if(HistogramBufferUp[I]& gt; 0 & amp& amphistogram buffer down[I+ 1]& lt; 0)

//if(HistogramBufferUp[I]& gt; HistogramBufferUp[i + 1])

{

//Cross up

if (flagval 1==0)

{

flag val 1 = 1;

flag val 2 = 0;

If (SoundON) Alert("MACD upward ","\n Time= ",TimeToStr(CurTime (), TIME_DATE)," ",TimeHour(CurTime ()),": ",TimeMinute(CurTime ())," \n Symbol= ",Symbol.

If (EmailON) SendMail("MACD crosses upward ","MACD crosses upward, Date="+TimeToStr(CurTime (), time _ date)+"+timehour (curtime ())+":"+timeminute (curtime ())+"symbol = "+symbol.

}

}

else if(HistogramBufferDown[I]& lt; 0 & amp& ampHistogramBufferUp[i + 1]>0)

//else if(HistogramBufferUp[I]& lt; HistogramBufferUp[i + 1])

{

//Cross down

if (flagval2==0)

{

flag val 2 = 1;

flag val 1 = 0;

If (SoundON) Alert("MACD crosses down ","\n Date= ",TimeToStr(CurTime (), TIME_DATE)," ",TimeHour(CurTime ()),": ",TimeMinute(CurTime ())," \n Symbol= ",Symbol.

If (EmailON) SendMail("MACD crosses down ","MACD crosses down ",Date="+TimeToStr(CurTime (), time _ date)+"+timehour (curtime ())+":"+timeminute (curtime ())+"symbol ="+.

}

}

}

}

//-Done

return(0);

}

Copy the above code into the document, for example, the name is macd2.mq4, and the suffix must be mq4. Then put it in the experts\indicators of the mt4 installation directory, and reopen mt4. You can see macd2 in the customization of technical indicators. end