For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Long Executed Price and Long Create Price is different

  • Hello,

    What is the difference between the executed price and ordered price?

    here is a part of the CSV file:

    Date,Open,High,Low,Close,Adj Close,Volume


    On 02-10,the close was 27.71 , and a long ordered was created.
    On 02-11,the close was 26.50, but the executed price was 27.80

    There is no 27.80 in the csv file. Can anyone explain?

    Here is part of the code on LONG BUY EXECUTED:

    if order.isbuy():
    self.log("LONG BUY EXECUTED,Price: %.2f, Quantity: %.2f, Cost: %.2f, Comm %.2f, ATR: %.2f" %

  • BT normally executes next candle open ( if market order ) after receiving the signal. For example if you are using 1 min candles to trade, if buy signal generated at candle 9:19 execution is done on 9:20 open ( if its a market order ). So signal generation price and execution price is not the same. You can cheat-on-close if you want to execute at close.

  • @rajanprabu
    okay, so this case the signal is at 2000-02-10
    so it should execute at the open of 2000-02-11 which should be 31.250, but its 27.80 for my case. why?

  • BT is using adjusted close value to adjust other four values. Have a look at Data Feeds

  • thanks! @rajanprabu

Log in to reply