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?

More than 5 years have passed since last update.

MQL5-単純な計算の方法 5

Last updated at Posted at 2020-05-27

はじめに

この記事は以下リンクのYoutubeビデオを翻訳したものになります。よければそちらもご覧ください。

前回記事 は以下です。

計算

MQL5でEAを作ったり、インジケータを作ったりするのに、必ず必要になるのか計算である。今回はコードを書いて四則演算させてみる。

いつものように、Ontick関数を残してすべて消す、そこから丹羽淳にint型で変数を二つ宣言してCommand関数を使って表示させる。

ちなみにintはInteger型で正数を表すデータ型である。

void OnTick()
  {
  int a = 5:
  int b = 3;

  Comment("The result:", a + b);
  }

さいごのComment関数内でa+bを計算して出力している。使える演算子は以下の通りだ

a+b //足し算
a-b //引き算
a*b //掛け算
a/b //割り算

もしもっと複雑な計算をしたければ、リファレンスを除くといろいろ見ることができる。
https://www.mql5.com/ja/docs/math

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?