トップ  >  MQL4リファレンス  >  基本  >  プリプロセッサ  >  プログラムプロパティ
スポンサーリンク
検索

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



書式:
#property 識別子 値




全てのMQL4プログラムは、プログラムの為の適切なサービスを#propertyで具体的なパラメータを指定する事が出来ます。
これはカスタムインジケータの外部設定にも使われます。

インクルードファイルに書かれたプロパティは完全に無視されます。
プロパティはメインのmq4ファイルで指定する必要があります。

コンパイラは実行モジュールの構成に宣言した値を書き込みます。




#property(共通)
識別子 詳細
strict - 厳格なコンパイルモード用のコンパイラ指令
icon string ex4プログラムのアイコンとして使用する画像ファイルへのパスを指定します。
パス指定のルールはresourcesと同じです。
アイコンファイルはico形式が使えます。
link string 作成者のwebサイトへのリンクを記載します。
copyright string 作成者(著作者)の名前を記載します。
version string プログラムのバージョンを記載します。
31文字まで記載出来ます。
description string プログラムの簡単な説明文を記載します。
この記述は複数行で記述する事が出来ます。
複数行に渡って記載する方法はサンプルソース参照。
全ての記述の全長は改行を含めて511文字が上限です。
stacksize int スタックサイズを指定。
スクリプトまたはEAを起動すると、少なくても8Mバイトのスタックが割り当てられる。
カスタムインジケータの場合は、スタックサイズは常に1Mバイトに固定されている。
ストラテジーテスターを起動すると、常に8Mバイトのスタックが割り当てられる。
library - start関数が割り当てられていないexport修飾子を持つ関数は、
他MQL4プログラムでインポートする事が出来ます。


#property(インジケータ用)
識別子 詳細
indicator_chart_window - カスタムインジケータをチャートウインドウに表示する
indicator_separate_window - カスタムインジケータをサブウインドウに表示する
indicator_height int インジケータサブウインドウの高さをピクセル単位で固定する。
固定値設定するのでサブウインドウを手動で変更出来なくなります。
(INDICATOR_HEIGHT)
indicator_buffers int インジケータ計算のバッファ数(範囲:1~512)
(アップデートで最大数が512まで増えました)
indicator_minimum double インジケーターサブウインドウの下限スケール設定
indicator_maximum double インジケーターサブウインドウの上限スケール設定
indicator_labelN string データウインドウに表示されるN番目のインジケータラベル
indicator_colorN color N番目のインジケータの色
indicator_widthN int N番目のインジケータの太さ
indicator_styleN int N番目のインジケータの線の種類
ENUM_LINE_STYLEの値で指定する。
indicator_typeN int N番目のインジケータの描画スタイル
Drawing Styles
indicator_levelNN double サブウインドウにNN番目のインジケータレベル(水平線レベル)を表示する
indicator_levelcolor color インジケータレベルの色(個別設定は出来ません)
indicator_levelwidth int インジケータレベルの線の太さ(個別設定は出来ません)
indicator_levelstyle int インジケータレベルの線の種類(個別設定は出来ません)。
ENUM_LINE_STYLE


#property(スクリプト用)
識別子 詳細
script_show_confirm - スクリプトを実行する前に確認ウインドウを表示する
script_show_inputs - スクリプトを実行する前にプロパティウインドウを表示し、確認ウインドウを無効にする。




#property(共通)サンプルソース:
#property strict

#property version     "1.23"                       // ソフトバージョン

// プログラムの説明
#property description "プログラム説明1"
#property description "プログラム説明22"
#property description "プログラム説明333"

#property link        "https://yukifx.web.fc2.com/" // webサイトリンク
#property copyright   "MT4でEA自作しちゃお~[FX自動売買(システムトレード)-MQL4プログラミング入門]"      // 著作者





#property(共通)サンプルソース:
// インジケータウインドウ設定
#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_color2    clrWhite       // インジケータ2の色:White
#property  indicator_width1    2                // インジケータ1の太さ:2
#property  indicator_width2    1                // インジケータ2の太さ:1
#property  indicator_type1     DRAW_HISTOGRAM // インジケータ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);
}






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


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


Top

inserted by FC2 system