0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【MT4, MQL4】Access violationについて

Posted at

エラー出力

Access violation read to 0x00000002 in ...

原因

double iSR(double &arr[]) {
   int size = ArraySize(arr);
   double sd = iStdDevOnArray(arr, 0, size, 0, 0, 0);
   return (sd == 0) ? 0 : iMAOnArray(arr, 0, size, 0, 0, 0) / sd;
}

配列のシャープレシオ(平均値/標準偏差)を求める関数。これをOnTester関数内で利用し、動的にリサイズした配列を参照渡しした場合、上記のエラーが発生しました。
よくわからないのですが、ArrayResizeによって動的に確保された配列は参照渡しできなさそうでした。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?