07/12/25 21:29:29.34 WfduRII2
>>298
2 line MACD.mq4ってファイル名なんだけどググっても出てくるソースがなんか違うんだわ
元々こうなのかアラート部分を自分が改造したか記憶にないけどうpするよ
そのまま使うのも良いけど、検証がてらに自分でソースを確認してね
もしかしたら間違ってる箇所があるかもしれないしね
//+------------------------------------------------------------------+
//| Custom MACD+OsMA.mq4 |
//| Copyright ゥ 2004, MetaQuotes Software Corp. |
//| URLリンク(www.metaquotes.net) |
//+------------------------------------------------------------------+
#property copyright "Copyright ゥ 2004, MetaQuotes Software Corp."
#property link "URLリンク(www.metaquotes.net)"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Silver
#property indicator_color2 Red
#property indicator_color3 Silver
//---- indicator parameters
extern int FastEMA=12;
extern int SlowEMA=26;
extern int SignalSMA=9;
extern bool AlertOn = true;
//---- indicator buffers
double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- drawing settings
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,2);
SetIndexDrawBegin(1,SignalSMA);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
//---- indicator buffers mapping
if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2) && !SetIndexBuffer(2,ind_buffer3))
Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
SetIndexLabel(0,"MACD");
SetIndexLabel(1,"Signal");
SetIndexLabel(2,"OsMA");
//---- initialization done
return(0);
}