昨日に引き続き、公式のドキュメントで怪しいと思った部分を翻訳していく。
how-to-make-stock-trading-system.dogwood008.com
<原文>
- The current data has already happened and cannot be used to execcute an order.
If the logic in the strategy is something like:
if self.data.close > self.sma: # where sma is a Simple Moving Average self.buy()
The expectation CANNOT be that the order will be executed with the close
price which is being examined in the logic BECAUSE it has already happened.
The order CAN BE 1st EXECUTED withing the bounds of the next set of Open/High/Low/Close price points (and the conditions set forth herein by the order)
https://www.backtrader.com/docu/order-creation-execution/order-creation-execution/ より
<訳文>
- 現在のデータは既に発生しており、注文を実行することはできない。
もし戦略のロジックが次のようなものであれば:
(Pythonのコード)
すでに起こったからといって、ロジックで検討されている終値 close
で注文が執行されることを期待してはいけない。
注文は、始値/高値/安値/終値の価格ポイントの次のセットの範囲内で初めて執行されるようになる(そして、その条件は注文によって前方へセットされる)。
意訳して要約すると、「ある日Xに出した注文は、Xの終値では約定せず、次営業日の四本値の範囲内で条件が満たされた場合に、初めて約定する」といったところでしょうか。
ただ、それでもなお、注文が通らないことの理由を全て説明できたわけではないので、引き続き調査していく。