mql5言語の特徴、微妙なニュアンスとテクニック - ページ 104 1...979899100101102103104105106107108109110111...247 新しいコメント fxsaber 2018.10.10 11:56 #1031 アンドレイ・ハチムリアンスキー市場レビューの楽器は何台?61. Andrey Khatimlianskii 2018.10.11 00:41 #1032 fxsaberビルド1907では、バグが奇跡的に消えました。ロールバックして探せばいいのか、それともここの何かが修正されただけなのか、それすらもわからない......。 Vladimir Pastushak 2018.10.11 15:27 #1033 インジケーター構築に関する質問 #property indicator_chart_window#property indicator_buffers 12#property indicator_plots 6#property indicator_type1 DRAW_COLOR_LINE#property indicator_type2 DRAW_COLOR_LINE#property indicator_type3 DRAW_COLOR_LINE#property indicator_type4 DRAW_COLOR_LINE#property indicator_type5 DRAW_COLOR_LINE#property indicator_type6 DRAW_COLOR_LINE SetIndexBuffer(0,upper_line,INDICATOR_DATA); SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX); PlotIndexSetString(0,PLOT_LABEL,"Upper Line"); PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle); PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth); PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2); PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp); PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);// ========== SetIndexBuffer(2,awera_line,INDICATOR_DATA); SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX); PlotIndexSetString(1,PLOT_LABEL,"Average Line"); PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle); PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth); PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2); PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp); PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw);// ========== SetIndexBuffer(4,lower_line,INDICATOR_DATA); SetIndexBuffer(5,lower_line_color,INDICATOR_COLOR_INDEX); PlotIndexSetString(2,PLOT_LABEL,"Lower Line"); PlotIndexSetInteger(2,PLOT_LINE_STYLE,LowerStyle); PlotIndexSetInteger(2,PLOT_LINE_WIDTH,LowerWidth); PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,2); PlotIndexSetInteger(2,PLOT_LINE_COLOR,0,LowerTrendUp); PlotIndexSetInteger(2,PLOT_LINE_COLOR,1,LowerTrendDw); カラーバッファーはいくつまで使用できますか? バッファーはどのようにリンクされているのですか? #property indicator_buffers 12 // 合計12個のバッファを宣言する。#property indicator_plots 6 //グラフィックの構築 indicator_type 1~6を指定すると、6つのグラフに対してカラーラインが引かれることを理解する、という理解で合っていますか? #property indicator_type1 DRAW_COLOR_LINE#property indicator_type2 DRAW_COLOR_LINE#property indicator_type3 DRAW_COLOR_LINE#property indicator_type4 DRAW_COLOR_LINE#property indicator_type5 DRAW_COLOR_LINE#property indicator_type6 DRAW_COLOR_LINE // ===== SetIndexBuffer(0,upper_line,INDICATOR_DATA); // データ用ファーストバッファーSetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX); // カラーデータ用セカンドバッファPlotIndexSetString(0,PLOT_LABEL, "Upper Line"); // 最初のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);// 最初のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);//1 番目のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);// 最初のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);// 最初のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);// 最初のバッファのプロパティを変更します。 SetIndexBuffer(2,awera_line,INDICATOR_DATA); // 3つ目のバッファーSetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX); // 4 番目の色のバッファPlotIndexSetString(1,PLOT_LABEL, "Average Line"); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) のバッファプロパティを変更します。PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。 Features of the mql5 HELP!!MT4からMT5へインジケーターを変換する。 Metatrader 5 coding questions 削除済み 2018.10.11 18:25 #1034 ウラジミール・パストゥシャクインジケーター構築に関する質問 #property indicator_chart_window#property indicator_buffers 12#property indicator_plots 6#property indicator_type1 DRAW_COLOR_LINE#property indicator_type2 DRAW_COLOR_LINE#property indicator_type3 DRAW_COLOR_LINE#property indicator_type4 DRAW_COLOR_LINE#property indicator_type5 DRAW_COLOR_LINE#property indicator_type6 DRAW_COLOR_LINE SetIndexBuffer(0,upper_line,INDICATOR_DATA); SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX); PlotIndexSetString(0,PLOT_LABEL,"Upper Line"); PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle); PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth); PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2); PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp); PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);// ========== SetIndexBuffer(2,awera_line,INDICATOR_DATA); SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX); PlotIndexSetString(1,PLOT_LABEL,"Average Line"); PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle); PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth); PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2); PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp); PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw);// ========== SetIndexBuffer(4,lower_line,INDICATOR_DATA); SetIndexBuffer(5,lower_line_color,INDICATOR_COLOR_INDEX); PlotIndexSetString(2,PLOT_LABEL,"Lower Line"); PlotIndexSetInteger(2,PLOT_LINE_STYLE,LowerStyle); PlotIndexSetInteger(2,PLOT_LINE_WIDTH,LowerWidth); PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,2); PlotIndexSetInteger(2,PLOT_LINE_COLOR,0,LowerTrendUp); PlotIndexSetInteger(2,PLOT_LINE_COLOR,1,LowerTrendDw); カラーバッファーはいくつまで使用できますか? バッファーはどのようにリンクされているのですか? #property indicator_buffers 12 // 合計12個のバッファを宣言する。#property indicator_plots 6 //グラフィックの構築 indicator_type 1~6を指定すると、6つのグラフに対してカラーラインが引かれることを理解する、という理解で合っていますか? #property indicator_type1 DRAW_COLOR_LINE#property indicator_type2 DRAW_COLOR_LINE#property indicator_type3 DRAW_COLOR_LINE#property indicator_type4 DRAW_COLOR_LINE#property indicator_type5 DRAW_COLOR_LINE#property indicator_type6 DRAW_COLOR_LINE // ===== SetIndexBuffer(0,upper_line,INDICATOR_DATA); // データ用ファーストバッファーSetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX); // カラーデータ用セカンドバッファPlotIndexSetString(0,PLOT_LABEL, "Upper Line"); // 最初のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);// 最初のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);//1 番目のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);// 最初のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);// 最初のバッファのプロパティを変更します。PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);// 最初のバッファのプロパティを変更します。 SetIndexBuffer(2,awera_line,INDICATOR_DATA); // 3つ目のバッファーSetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX); // 4 番目の色のバッファPlotIndexSetString(1,PLOT_LABEL, "Average Line"); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) のバッファプロパティを変更します。PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。質問のために別のブランチを作成したほうがいい。このブランチは機能に関するものであり、ここで議論するべきではありません。 描画の原理をよりよく理解するために、機能を段階的に実装する。1つのラインを構築し、その機能を確認し、次のラインを追加します。 各図形系列(この場合はカラーライン)は、1つのカラーバッファしか持つことができません。各バッファーには多くの色を入れることができます。 Andrey Khatimlianskii 2018.10.11 21:20 #1035 アンドレイ・ハチムリアンスキー1907年のビルドでは、奇跡的にバグがなくなりました。ロールバックして探すのか、それともここの何かが修正されただけなのかもわからないし......。エラーはなくなりましたが、イベントキューに関する問題はなくなりませんでした。数時間後、端末はCPUに最大95%まで負荷をかけ始めます。そして、何かというと、ダニを飛ばしてしまう。 2018.10.11 23:56:54.069 Terminal MetaTrader 5 x64 build 1907 started (MetaQuotes Software Corp.) 2018.10.11 23:56:54.139 Terminal Windows 8.1 (build 9600) x64, IE 11, UAC, Intel Core i5-3570 @ 3.40 GHz, Memory: 11580 / 16346 Mb, Disk: 401 / 499 Gb, GMT+2 スラバ さん、19xxビルドでChartEventに何か変更があったのでしょうか?ビルドで問題は再現されますか? Andrey Khatimlianskii 2018.10.12 12:20 #1036 アンドレイ・ハチムリアンスキーエラーはなくなりましたが、イベントキューの問題はなくなりません。数時間稼働すると、端末はCPUに95%まで負荷をかけるようになる。そして、何かというと、ダニがいなくなる。 スラバ さん、19xxビルドでChartEventに何か変更があったのでしょうか?あなたの問題は再現されていますか?端末が15時間稼働した後のリソースの監視の様子です(スパイのイベント送信の最小周波数は500ms)。 起動後数時間はCPU負荷が0に近いですが。 Andrey Khatimlianskii 2018.10.12 19:31 #1037 アンドレイ・ハチムリアンスキー端末を15時間稼働させた場合のリソース監視の様子です(スパイウェアのイベント送信速度は最小で500ms)。 起動後数時間はCPU負荷が0に近いですが。Bild 1908 - 変更なし。 fxsaber 2018.10.14 11:53 #1038 ベースとなる型構造演算子を置き換えることができるため、状況によっては柔軟に対応することができます。 例として、構造体の配列をカスタムソート するテクニックの1つを紹介します。 // Основная структура struct A { int a; int b; // Правило сортировки bool operator > ( const A& Value ) const { return(this.a > Value.a); } }; // Вспомогательная структура для изменения правила сортировки struct B : A { // Перегрузка правила сортировки bool operator > ( const A& Value ) const { return(this.b > Value.b); } }; // Простая сортировка template <typename T1, typename T2> // T2 - по какому правилу сортируем void Sort( T1 &Array[] ) { const int Size = ArraySize(Array); for (int i = 0; i < Size - 1; i++) { T2 Min = Array[i]; int Pos = i; for (int j = i + 1; j < Size; j++) if (Min > Array[j]) { Min = Array[j]; Pos = j; } if (Pos != i) { Array[Pos] = Array[i]; Array[i] = Min; } } } void OnStart() { A Array[3] = {{2, 2}, {3,1}, {1, 3}}; ArrayPrint(Array); // Сортировка по правилу A Sort<A, A>(Array); ArrayPrint(Array); // Сортировка по правилу B Sort<A, B>(Array); ArrayPrint(Array); } 結果 [a] [b] [0] 2 2 [1] 3 1 [2] 1 3 [a] [b] [0] 1 3 [1] 2 2 [2] 3 1 [a] [b] [0] 3 1 [1] 2 2 [2] 1 3 これはおそらく、古代の自転車だと思います。 TheXpert 2018.10.14 12:02 #1039 fxsaber基本型構造の演算子を置き換えることができるため、状況に応じて柔軟に対応することができる。mqlでは、<演算子は必ずクラス/構造体のメソッド でなければなりません。 つまり、埋め込み型の構造体や、不変の構造体には設定できない。 これはテンプレートの比較関数を追加することで少し改善され、デフォルトで<演算子を呼び出します。 UPD: < 演算子を随所に書いているのは、通常は > よりもオーバーロードされるからで、厳密ではないが、一般に受け入れられている。 fxsaber 2018.10.14 12:23 #1040 TheXpert です。mqlでは、<演算子はクラス/構造体のメソッド でなければなりません。 埋め込み構造には 設定できないということです。 あるいは、イミュータブル構造には設定できないということです。 // Вспомогательная структура для изменения правила сортировки struct MQLTICK_BID : MqlTick { // Сортировка по времени bool operator <( const MqlTick& Value ) const { return(this.bid < Value.bid); } }; // Простая сортировка template <typename T1, typename T2> // T2 - по какому правилу сортируем void Sort( T1 &Array[] ) { const int Size = ArraySize(Array); for (int i = 0; i < Size - 1; i++) { T2 Min = Array[i]; int Pos = i; for (int j = i + 1; j < Size; j++) if (Min < Array[j]) { Min = Array[j]; Pos = j; } if (Pos != i) { Array[Pos] = Array[i]; Array[i] = Min; } } } void OnStart() { MqlTick Ticks[]; CopyTicks(_Symbol, Ticks, COPY_TICKS_ALL, 0, 5); ArrayPrint(Ticks); // Сортировка по правилу MQLTICK_BID Sort<MqlTick, MQLTICK_BID>(Ticks); ArrayPrint(Ticks); } 結果 [time] [bid] [ask] [last] [volume] [time_msc] [flags] [volume_real] [0] 2018.10.11 23:59:55 1.09115 1.09354 0.00000 0 1539302395303 6 0.00000 [1] 2018.10.11 23:59:56 1.09132 1.09348 0.00000 0 1539302396037 6 0.00000 [2] 2018.10.11 23:59:56 1.09131 1.09353 0.00000 0 1539302396302 6 0.00000 [3] 2018.10.11 23:59:59 1.09135 1.09354 0.00000 0 1539302399458 6 0.00000 [4] 2018.10.11 23:59:59 1.09139 1.09378 1.09260 0 1539302399989 14 0.00000 [time] [bid] [ask] [last] [volume] [time_msc] [flags] [volume_real] [0] 2018.10.11 23:59:59 1.09139 1.09378 1.09260 0 1539302399989 14 0.00000 [1] 2018.10.11 23:59:59 1.09135 1.09354 0.00000 0 1539302399458 6 0.00000 [2] 2018.10.11 23:59:56 1.09132 1.09348 0.00000 0 1539302396037 6 0.00000 [3] 2018.10.11 23:59:56 1.09131 1.09353 0.00000 0 1539302396302 6 0.00000 [4] 2018.10.11 23:59:55 1.09115 1.09354 0.00000 0 1539302395303 6 0.00000 この方法は、テンプレートの比較関数を追加することで少し改良することができ、デフォルトで<演算子を呼び出します。typedefを使う場合は、構造体だけでなく、標準的な数値型にもソート関数を定義する必要があります。というか、何を言っているのか理解できないのですが。 1...979899100101102103104105106107108109110111...247 新しいコメント 理由: キャンセル 取引の機会を逃しています。 無料取引アプリ 8千を超えるシグナルをコピー 金融ニュースで金融マーケットを探索 新規登録 ログイン スペースを含まないラテン文字 このメールにパスワードが送信されます エラーが発生しました Googleでログイン WebサイトポリシーおよびMQL5.COM利用規約に同意します。 新規登録 MQL5.com WebサイトへのログインにCookieの使用を許可します。 ログインするには、ブラウザで必要な設定を有効にしてください。 ログイン/パスワードをお忘れですか? Googleでログイン
市場レビューの楽器は何台?
61.
ビルド1907では、バグが奇跡的に消えました。ロールバックして探せばいいのか、それともここの何かが修正されただけなのか、それすらもわからない......。
インジケーター構築に関する質問
#property indicator_chart_window
#property indicator_buffers 12
#property indicator_plots 6
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_type6 DRAW_COLOR_LINE
SetIndexBuffer(0,upper_line,INDICATOR_DATA);
SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(0,PLOT_LABEL,"Upper Line");
PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);
PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);
PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);
// ==========
SetIndexBuffer(2,awera_line,INDICATOR_DATA);
SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(1,PLOT_LABEL,"Average Line");
PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle);
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth);
PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw);
// ==========
SetIndexBuffer(4,lower_line,INDICATOR_DATA);
SetIndexBuffer(5,lower_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(2,PLOT_LABEL,"Lower Line");
PlotIndexSetInteger(2,PLOT_LINE_STYLE,LowerStyle);
PlotIndexSetInteger(2,PLOT_LINE_WIDTH,LowerWidth);
PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,0,LowerTrendUp);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,1,LowerTrendDw);
カラーバッファーはいくつまで使用できますか?
バッファーはどのようにリンクされているのですか?
#property indicator_buffers 12 // 合計12個のバッファを宣言する。
#property indicator_plots 6 //グラフィックの構築
indicator_type 1~6を指定すると、6つのグラフに対してカラーラインが引かれることを理解する、という理解で合っていますか?
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_type6 DRAW_COLOR_LINE
// =====
SetIndexBuffer(0,upper_line,INDICATOR_DATA); // データ用ファーストバッファー
SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX); // カラーデータ用セカンドバッファ
PlotIndexSetString(0,PLOT_LABEL, "Upper Line"); // 最初のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);// 最初のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);//1 番目のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);// 最初のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);// 最初のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);// 最初のバッファのプロパティを変更します。
SetIndexBuffer(2,awera_line,INDICATOR_DATA); // 3つ目のバッファー
SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX); // 4 番目の色のバッファ
PlotIndexSetString(1,PLOT_LABEL, "Average Line"); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) のバッファプロパティを変更します。
PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
インジケーター構築に関する質問
#property indicator_chart_window
#property indicator_buffers 12
#property indicator_plots 6
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_type6 DRAW_COLOR_LINE
SetIndexBuffer(0,upper_line,INDICATOR_DATA);
SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(0,PLOT_LABEL,"Upper Line");
PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);
PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);
PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);
// ==========
SetIndexBuffer(2,awera_line,INDICATOR_DATA);
SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(1,PLOT_LABEL,"Average Line");
PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle);
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth);
PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp);
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw);
// ==========
SetIndexBuffer(4,lower_line,INDICATOR_DATA);
SetIndexBuffer(5,lower_line_color,INDICATOR_COLOR_INDEX);
PlotIndexSetString(2,PLOT_LABEL,"Lower Line");
PlotIndexSetInteger(2,PLOT_LINE_STYLE,LowerStyle);
PlotIndexSetInteger(2,PLOT_LINE_WIDTH,LowerWidth);
PlotIndexSetInteger(2,PLOT_COLOR_INDEXES,2);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,0,LowerTrendUp);
PlotIndexSetInteger(2,PLOT_LINE_COLOR,1,LowerTrendDw);
カラーバッファーはいくつまで使用できますか?
バッファーはどのようにリンクされているのですか?
#property indicator_buffers 12 // 合計12個のバッファを宣言する。
#property indicator_plots 6 //グラフィックの構築
indicator_type 1~6を指定すると、6つのグラフに対してカラーラインが引かれることを理解する、という理解で合っていますか?
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_type2 DRAW_COLOR_LINE
#property indicator_type3 DRAW_COLOR_LINE
#property indicator_type4 DRAW_COLOR_LINE
#property indicator_type5 DRAW_COLOR_LINE
#property indicator_type6 DRAW_COLOR_LINE
// =====
SetIndexBuffer(0,upper_line,INDICATOR_DATA); // データ用ファーストバッファー
SetIndexBuffer(1,upper_line_color,INDICATOR_COLOR_INDEX); // カラーデータ用セカンドバッファ
PlotIndexSetString(0,PLOT_LABEL, "Upper Line"); // 最初のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_LINE_STYLE,UpperStyle);// 最初のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_LINE_WIDTH,UpperWidth);//1 番目のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,2);// 最初のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,UpperTrendUp);// 最初のバッファのプロパティを変更します。
PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,UpperTrendDw);// 最初のバッファのプロパティを変更します。
SetIndexBuffer(2,awera_line,INDICATOR_DATA); // 3つ目のバッファー
SetIndexBuffer(3,awera_line_color,INDICATOR_COLOR_INDEX); // 4 番目の色のバッファ
PlotIndexSetString(1,PLOT_LABEL, "Average Line"); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) のバッファプロパティを変更します。
PlotIndexSetInteger(1,PLOT_LINE_STYLE,AverageStyle); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
PlotIndexSetInteger(1,PLOT_LINE_WIDTH,AverageWidth); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
PlotIndexSetInteger(1,PLOT_COLOR_INDEXES,2); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
PlotIndexSetInteger(1,PLOT_LINE_COLOR,0,AverageTrendUp); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
PlotIndexSetInteger(1,PLOT_LINE_COLOR,1,AverageTrendDw); // SetIndexBuffer(2,awera_line,INDICATOR_DATA) 用バッファのプロパティを変更します。
質問のために別のブランチを作成したほうがいい。このブランチは機能に関するものであり、ここで議論するべきではありません。
描画の原理をよりよく理解するために、機能を段階的に実装する。1つのラインを構築し、その機能を確認し、次のラインを追加します。
各図形系列(この場合はカラーライン)は、1つのカラーバッファしか持つことができません。各バッファーには多くの色を入れることができます。
1907年のビルドでは、奇跡的にバグがなくなりました。ロールバックして探すのか、それともここの何かが修正されただけなのかもわからないし......。
エラーはなくなりましたが、イベントキューに関する問題はなくなりませんでした。数時間後、端末はCPUに最大95%まで負荷をかけ始めます。そして、何かというと、ダニを飛ばしてしまう。
スラバ さん、19xxビルドでChartEventに何か変更があったのでしょうか?ビルドで問題は再現されますか?
エラーはなくなりましたが、イベントキューの問題はなくなりません。数時間稼働すると、端末はCPUに95%まで負荷をかけるようになる。そして、何かというと、ダニがいなくなる。
スラバ さん、19xxビルドでChartEventに何か変更があったのでしょうか?あなたの問題は再現されていますか?
端末が15時間稼働した後のリソースの監視の様子です(スパイのイベント送信の最小周波数は500ms)。
起動後数時間はCPU負荷が0に近いですが。
端末を15時間稼働させた場合のリソース監視の様子です(スパイウェアのイベント送信速度は最小で500ms)。
起動後数時間はCPU負荷が0に近いですが。
Bild 1908 - 変更なし。
ベースとなる型構造演算子を置き換えることができるため、状況によっては柔軟に対応することができます。
例として、構造体の配列をカスタムソート するテクニックの1つを紹介します。
結果
これはおそらく、古代の自転車だと思います。
基本型構造の演算子を置き換えることができるため、状況に応じて柔軟に対応することができる。
mqlでは、<演算子は必ずクラス/構造体のメソッド でなければなりません。
つまり、埋め込み型の構造体や、不変の構造体には設定できない。
これはテンプレートの比較関数を追加することで少し改善され、デフォルトで<演算子を呼び出します。
UPD: < 演算子を随所に書いているのは、通常は > よりもオーバーロードされるからで、厳密ではないが、一般に受け入れられている。mqlでは、<演算子はクラス/構造体のメソッド でなければなりません。
埋め込み構造には 設定できないということです。 あるいは、イミュータブル構造には設定できないということです。
結果
この方法は、テンプレートの比較関数を追加することで少し改良することができ、デフォルトで<演算子を呼び出します。
typedefを使う場合は、構造体だけでなく、標準的な数値型にもソート関数を定義する必要があります。というか、何を言っているのか理解できないのですが。