【MT4】MetaTrader Part17【メタトレーダー】

このエントリーをはてなブックマークに追加
219Trader@Live!
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Yellow
extern int time1=21; //FXでの日にち交代時間
extern int time2=5; //欧州時間開始時刻
extern int time3=19; //欧州時間〜オセアニア時間の遷移時間
double buf[];
double close, open;
int init() {SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1); SetIndexBuffer(0,buf); return(0);}
int deinit() { delete_obj(); return(0);}
int start()
{
int i;
int Limit,counted_bars=IndicatorCounted();
if(counted_bars<0) return(0);
if(counted_bars>0) counted_bars--;
Limit=Bars-counted_bars;
for (i=0;i<Limit;i++)
{if( TimeHour(Time[i+1]) != TimeHour(Time[i]) )
{if( TimeHour(Time[i]) == time1) { open=Open[i] ; vertical_dot_Line(i, White,0); }
if( TimeHour(Time[i]) == time2) { open=Open[i] ; vertical_dot_Line(i, Red,1); }
//if( TimeHour(Time[i]) == time3) { open=Open[i] ; vertical_dot_Line(i, Blue,1); }
}
close = Close[i];
buf[i] = close - open;
}
return(0);}

void vertical_dot_Line(int lx0, color c,int style)
{ string name = "123456_"+lx0 ;
ObjectCreate(name,OBJ_VLINE,0, Time[lx0],0,0);
ObjectSet(name,OBJPROP_COLOR,c);
ObjectSet(name,OBJPROP_STYLE,style);
ObjectSet(name,OBJPROP_WIDTH,1);
}

void delete_obj()
{string name = "";
for(int i=ObjectsTotal()-1;i>=0;i--)
{name = ObjectName(i);
if(StringFind(name,"12345",0)==0)
ObjectDelete(name);
} }