引数名 | 初期値 | I/O | 詳細 |
index | - | In | インジケータバッファのインデックス。
インデックスは0から始まります。 #property indicator_buffersで宣言した値より小さい値を設定します |
buffer[] | - | In | カスタムインジケータプログラムで宣言した配列を指定します。
(インジケータ描画したいデータ配列を指定) |
// インジケータウインドウ設定 #property indicator_separate_window // インジケータをサブウインドウに表示 #property indicator_minimum -1000 // サブウインドウのスケール下限:-1000 #property indicator_maximum 3500 // サブウインドウのスケール上限: 3500 // インジケータ設定 #property indicator_buffers 2 // インジケータバッファ:2つに設定 #property indicator_color1 clrGreen // インジケータ1の色:Green #property indicator_width1 2 // インジケータ1の太さ:2 #property indicator_type1 DRAW_HISTOGRAM // インジケータ1の種類:ヒストグラム #property indicator_color2 clrWhite // インジケータ2の色:White #property indicator_width2 1 // インジケータ2の太さ:1 #property indicator_type2 DRAW_LINE // インジケータ2の種類:線 // レベルライン設定 #property indicator_level1 0 // レベルライン:0 #property indicator_level2 1000 // レベルライン:1000 #property indicator_level3 2000 // レベルライン:2000 #property indicator_level4 3000 // レベルライン:3000 #property indicator_levelcolor clrGray // レベルラインの色:Gray #property indicator_levelwidth 1 // レベルラインの太さ:1 #property indicator_levelstyle STYLE_DOT // レベルラインの種類:ドット線 double ExIndLine[100]; // インジケータバッファ:ライン用 double ExIndVol[100]; // インジケータバッファ:ヒストグラム用 //+------------------------------------------------------------------+ //| OnInit(初期化)イベント | //|------------------------------------------------------------------| void OnInit() { SetIndexBuffer(0,ExIndVol); // ExIndVolをインジケータ1に登録 SetIndexBuffer(1,ExIndLine); // ExIndLineをインジケータ2に登録 } //+------------------------------------------------------------------+ //| OnCalculate(tick受信)イベント | //+------------------------------------------------------------------+ int OnCalculate( const int rates_total, // 入力された時系列のバー数 const int prev_calculated,// 計算済み(前回呼び出し時)のバー数 const datetime& time[], // 時間 const double& open[], // 始値 const double& high[], // 高値 const double& low[], // 安値 const double& close[], // 終値 const long& tick_volume[], // Tick出来高 const long& volume[], // Real出来高 const int& spread[]) // スプレッド { int icount = 0; int icountend; icountend = rates_total - prev_calculated; if ( icountend >= rates_total ) { icountend = rates_total - 1; } for( icount = 0; icount <= icountend ; icount++ ) { ExIndVol[icount] = tick_volume[icount]; // インジケータバッファに出来高を代入 ExIndLine[icount] = tick_volume[icount]; // インジケータバッファに出来高を代入 } return(rates_total); }