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

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


SetIndexStyle


インジケータライン用に、新しいタイプ・スタイル・幅・色の設定を行います。


関数書式:
void  SetIndexStyle(
   int     index,            // インジケータバッファインデックス
   int     type,             // タイプ
   int     style = EMPTY,   // スタイル
   int     width = EMPTY,   // 幅
   color   clr   = clrNONE  // 色
   );



■引数
引数名 初期値 I/O 詳細
index - In インジケータバッファインデックス
指定範囲は0~7です。
type - In 形状タイプ。
描画スタイル列挙のDRAW_XXXXXの値を指定します
style EMPTY In 描画スタイル。
太さ設定が1のラインに適用されます。
ENUM_LINE_STYLE列挙の値を指定します。
EMPTYはスタイルが変更されない事を意味します。
width EMPTY In ラインの太さ。
設定範囲は1~5まで。
EMPTYは変更されない事を意味します。
clr clrNONE 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のラベル設定

    // インジケータ2の設定を変更
    SetIndexStyle(1, DRAW_LINE , STYLE_DOT , 1 , clrAqua);
}



//+------------------------------------------------------------------+
//| 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