2018年5月10日木曜日
[MQL4] SELECT_BY_POS のソート順は保証されていない
OrdersHistoryTotal() のドキュメントに以下のような記述があります。
Consecutive selection of orders using the SELECT_BY_POS parameter returns information in the sequence in which it was received from the trading server. Sorting of the resulting list of orders cannot be guaranteed.
最後にさらりと、「ソート順は保証されていません」と書いてあるではないですか。
つまり、直近の履歴だけを見たい場合でも、最低1回はループを回さないといけないわけですね。
そりゃ、「口座履歴」タブで取得期間を絞っておく必要があるわけだ。
参考