MQL

For ループの中にアラート呼び出しを書くと初回起動したときに過去のアラートが全部表示される問題対策

MQL

if (counted_bars==0) limit=Bars-MathMax(PerNR,PerATR); if(counted_bars<0) return(-1);//---- last counted bar will be recounted if(counted_bars>0) limit=Bars-counted_bars; limit--; //---- main loop for(int i=limit; i>=0; i--) { tempval=0.0;…

iBarshift関数の位置を実際に見てみよう

MQL

#property strict #property indicator_chart_windowvoid OnInit(){ // オブジェクト全削除 ObjectsDeleteAll(); datetime StartTime =D'2017.02.17 15:48:30'; int iStart = iBarShift( NULL, 0, StartTime); // 垂直線オブジェクト(Time[iStart]の位置に作…

Property Strict設定

MQL

datetime date = D'2014.03.05 15:46:58'; string str = "mydate="+date; Print(str); // mydate=1394034418 - 古いMQL4での結果 // mydate=1394034418 - 新しいMQL4で#property strict無しの時の結果 // mydate=2014.03.05 15:46:58 - 新しいMQL4で#property…

オブジェクト表示-基本サブウインドウ

MQL

#property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 1 // 初期化関数はウインドウ作成前に実行されるのでWIN_IDを確定することができない。 int init() { return(0); }// 終了関数はいらない。サブウインドウ…

オブジェクト表示-基本メインウインドウ

MQL

#property indicator_chart_window// 初期化関数 int init() { int win_idx = 0; // ウィンドウ番号 // ラベル用オブジェクトの生成 左上 ObjectCreate("Label0", OBJ_LABEL, win_idx, 0, 0); ObjectSet("Label0", OBJPROP_CORNER, 3); ObjectSet("Label0", …