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

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
    2000-02-10,30.000000,31.312500,29.000000,31.156250,27.713177,45288600
    2000-02-11,31.250000,32.375000,29.375000,29.843750,26.545721,55774000
    2000-02-14,30.437500,31.125000,29.312500,31.093750,27.657583,37599800
    

    d253e6f5-2ee6-4fe9-999f-bedefb5a34a5-image.png

    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" %
                             (order.executed.price,
                              (order.executed.value/
                               order.executed.price),
                              order.executed.value,
                              order.executed.comm,
                              self.my_atr*1))
    


  • 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
 

});