
MT4・MT5 コンパイルエラー・警告 警告(コンパイルは通る)
return value of 'OrderSend' should be checked
- エラー番号
warning 83- 意味
- 関数の戻り値を確認していない
「return value of 'OrderSend' should be checked」とは
OrderSend()・OrderClose()・OrderModify()・OrderSelect() などの戻り値を使わずに呼んだときの警告です。コンパイルは通りますが、注文が失敗しても気づけないので、戻り値を確認するように直すのがおすすめです。
MetaEditor での表示例
| MT4 | warning 83: return value of 'OrderSend' should be checked |
|---|---|
| MT5 | warning 83: return value of 'OrderSend' should be checked |
実際のログでは先頭に「ファイル名(行,列) :」が付きます。ログの行をダブルクリックすると、エラーの場所にカーソルが移動します。表示は 2026年9月の MetaEditor で確認したもので、ビルドによって細部が変わることがあります。
「return value of 'OrderSend' should be checked」の主な原因
- OrderSend(…); のように戻り値を受け取らずに呼んだ
- OrderClose()・OrderModify()・OrderSelect() の戻り値を if で判定していない
「return value of 'OrderSend' should be checked」の対処法
- int ticket = OrderSend(…); として、ticket < 0 なら GetLastError() でエラーを記録する
- bool を返す関数は if(!OrderClose(…)) のように判定する
コード例(MQL4)
// 戻り値を確認する(return value of 'OrderSend' should be checked 対策)(MQL4)
// NG
// OrderSend(Symbol(), OP_BUY, 0.1, Ask, 30, 0, 0);
// OK
void Buy(double lots)
{
int ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, 30, 0, 0, "", 0, 0, clrNONE);
if(ticket < 0)
Print("OrderSend error ", GetLastError());
}
void CloseTicket(int ticket)
{
if(!OrderSelect(ticket, SELECT_BY_TICKET)) return;
if(!OrderClose(ticket, OrderLots(), OrderClosePrice(), 30, clrNONE))
Print("OrderClose error ", GetLastError());
}MetaEditor(MT4)でコンパイルできることを確認済みです。自分のEAに組み込むときは、変数名や設定値を合わせてください。
関連するエラー
コンパイルエラー・警告の解説一覧
- undeclared identifier
- semicolon expected
- unexpected token
- unexpected token, probably type is missing?
- some operator expected
- unexpected end of program
- unbalanced parentheses
- closing quote '"' expected
- wrong parameters count
- function already defined and has body
- variable already defined
- function must have a body
- function not defined
- not all control paths return a value
- function must return a value
- expression of 'void' type is illegal
- event handling function not found
- function declared with wrong type or/and parameters
- possible loss of data due to type conversion
- truncation of constant value
- implicit conversion from 'number' to 'string'
- return value of 'OrderSend' should be checked
- declaration hides global variable
- l-value required
- constant cannot be modified
- constant expression required
- invalid index value
- array required
- arrays are passed by reference only
- parameter conversion not allowed
- illegal operation use
- illegal 'else' without matching 'if'
- 'break' must be used within some loop or switch statement
- case value already used
- ambiguous call to overloaded function
- can't open include file
- unknown property
- identifier already used
- struct member undefined
- struct or class type expected
- private member access error
- cannot instantiate abstract class
- structures or classes containing objects are not allowed
- function declarations are allowed on global, namespace or class scope only
- name expected
- division by zero in the constant expression
- expression has no effect
- expression not boolean
- sign mismatch
- possible use of uninitialized variable
- empty controlled statement found
- macro redefinition
- call resolves to … due to new rules of method hiding
- cannot be used for static allocated array












