トップ  >  MQL4リファレンス  >  カスタムインジケータ  >  SetIndexLabel
スポンサーリンク
検索

↑の検索エンジンが表示されない人は、
↓の古い検索エンジンを使用して下さい。
カスタム検索
MQL4リファレンスツリー
SetIndexLabel


SetIndexLabel


データウインドウとツールチップで表示する描画ラインラベルを設定します。


関数書式:
void  SetIndexLabel(
   int     index,       // インジケータバッファインデックス
   string  text         // ラベル文
   );



■引数
引数名 初期値 I/O 詳細
index - In インジケータバッファインデックス
指定範囲は0~7です。
text - In ラベル文。


■戻り値
無し



■備考
無し

サンプルソース:
// インジケータウインドウ設定
#property  indicator_chart_window          // インジケータをチャートウインドウに表示

// インジケータ設定
#property  indicator_buffers   2                // インジケータバッファ:2つに設定
#property  indicator_color1    clrYellow       // インジケータ1の色:黄色
#property  indicator_color2    clrWhite       // インジケータ1の色:白
#property  indicator_width1    1                // インジケータ1の太さ:1
#property  indicator_width2    2                // インジケータ1の太さ:2


double ExIndLine25[100];                           // インジケータバッファ1:ライン用
double ExIndLine75[100];                           // インジケータバッファ2:ライン用


//+------------------------------------------------------------------+
//| OnInit(初期化)イベント                         |
//|------------------------------------------------------------------|
void OnInit()
{
    SetIndexBuffer(0,ExIndLine25);              // ExIndVol25をインジケータ1に登録
    SetIndexBuffer(1,ExIndLine75);              // ExIndVol75をインジケータ2に登録

    SetIndexStyle(0,DRAW_LINE);              // インジケータスタイルをラインに設定
    SetIndexStyle(1,DRAW_LINE);              // インジケータスタイルをラインに設定

    SetIndexLabel(0,"SMA:25");                   // インジケータ1のラベル設定
    SetIndexLabel(1,"SMA:75");                   // インジケータ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++ ) {
        ExIndLine25[icount]  = iMA(NULL,0,25,0,MODE_SMA,PRICE_CLOSE,icount);
        ExIndLine75[icount]  = iMA(NULL,0,75,0,MODE_SMA,PRICE_CLOSE,icount);
    }


    return(rates_total);
}








スポンサーリンク
スポンサーリンク


Copyright ©2015 MT4でEA自作しちゃお~ All Rights Reserved.


Top

inserted by FC2 system