クリティカルエラーが発生し、デバックをストップしましたとなります、、お手上げ、、何がどう悪いのか、もう僕ではわかりません、なんとかならないでしょうか、、よろしくお願いします、
ありがとうございます。ちゃんと描画するのが不思議で仕方がないほどの知識しかありませが、これからも勉強を続けてみようと思います。
ほんとうに重ね重ねありがとうございます。
//+------------------------------------------------------------------+ //| Snake_alfa.mq5 | //| Copyright 2022, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2022, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.02" #property strict #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 clrWhite #property indicator_width1 2 // パラメーター input int Snake_HalfCycle = 7; // Snake_HalfCycle input int InpBars = 1000; // Custom_Bars // バッファ double Snake_Buffer[]; // 内部変数 int Snake_FullCycle; //+------------------------------------------------------------------+ //| LWMA(線形加重移動平均) | //+------------------------------------------------------------------+ double LWMA(const double &src[], int shift, int period) { double sum = 0.0, wsum = 0.0; for(int i = 0; i < period; i++) { double w = period - i; sum += src[shift - i] * w; wsum += w; } return sum / wsum; } //+------------------------------------------------------------------+ //| 初期化 | //+------------------------------------------------------------------+ int OnInit() { SetIndexBuffer(0, Snake_Buffer, INDICATOR_DATA); ArrayInitialize(Snake_Buffer, EMPTY_VALUE); Snake_FullCycle = Snake_HalfCycle * 2 + 1; PlotIndexSetInteger(0, PLOT_DRAW_BEGIN, Snake_FullCycle + 1); return INIT_SUCCEEDED; } //+------------------------------------------------------------------+ //| 計算 | //+------------------------------------------------------------------+ 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[], const long &volume[], const int &spread[]) { if(rates_total <= Snake_FullCycle) return 0; int start = MathMax(prev_calculated - 1, Snake_FullCycle); // 合成価格バッファ static double price[]; ArrayResize(price, rates_total); for(int i = start; i < rates_total; i++) price[i] = (2 * close[i] + high[i] + low[i]) / 4.0; // Snake ライン計算 for(int i = start; i < rates_total; i++) Snake_Buffer[i] = LWMA(price, i, Snake_FullCycle); // 古いバーを消す int limit = rates_total - InpBars; if(limit > 0) for(int i = 0; i < limit; i++) Snake_Buffer[i] = EMPTY_VALUE; return rates_total; }
一年近く経過してるので解決してるかも知れませんけど、意図的にはこういう事なのでしょうか?
取引の機会を逃しています。
- 無料取引アプリ
- 8千を超えるシグナルをコピー
- 金融ニュースで金融マーケットを探索
上記のように修正してみましたが、いまだになおりません。。。