Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Cheat on close takes the next bar's execution date and the current bar's execution price

    General Code/Help
    1
    1
    21
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Suraj Thorat 0
      Suraj Thorat 0 last edited by

      Is there a way to make cheat on close execute the orders on the same bar as well as give the date of the same bar. Right now the notify_trade takes current bar's execution price but next bar's date as an execution date.

      2005-03-07, ------------BUY order placed------------
      2005-03-07, EOD Close: 112.98   mOnthlY close 102.74  Current ATR 11.81   Stop Loss at 101.17
      2005-03-08, BUY EXECUTED: test, Price: 112.98,status: 4.00, Cost: 112.98, Comm 0.00
      2005-03-08 test Opened: PnL Gross 0.0, Net 0.0
      112.98
      -sell stop trail--sell stop trail-
      2007-10-17, SELL EXECUTED: test, Price: 565.42, Cost: 112.98, Comm 0.00
      2007-10-17 test Closed: PnL Gross 452.44, Net 452.44
      112.98
      2007-10-17, ------------BUY order placed------------
      2007-10-17, EOD Close: 671.89   mOnthlY close 317.54  Current ATR 172.47   Stop Loss at 499.42
      2007-10-18, BUY EXECUTED: test, Price: 671.89,status: 4.00, Cost: 671.89, Comm 0.00
      2007-10-18 test Opened: PnL Gross 0.0, Net 0.0
      671.89
      -sell stop trail--sell stop trail-
      2008-10-23, SELL EXECUTED: test, Price: 305.79, Cost: 671.89, Comm 0.00
      2008-10-23 test Closed: PnL Gross -366.1, Net -366.1
      671.89
      2014-05-19, ------------BUY order placed------------
      2014-05-19, EOD Close: 560.03   mOnthlY close 447.60  Current ATR 74.87   Stop Loss at 485.16
      2014-05-20, BUY EXECUTED: test, Price: 560.03,status: 4.00, Cost: 560.03, Comm 0.00
      2014-05-20 test Opened: PnL Gross 0.0, Net 0.0
      560.03
      -sell stop trail--sell stop trail-
      2020-03-09, SELL EXECUTED: test, Price: 1124.79, Cost: 560.03, Comm 0.00
      2020-03-09 test Closed: PnL Gross 564.76, Net 564.76
      560.03
      2020-05-08, ------------BUY order placed------------
      2020-05-08, EOD Close: 1561.80   mOnthlY close 1514.05  Current ATR 328.55   Stop Loss at 1233.25
      2020-05-11, BUY EXECUTED: test, Price: 1561.80,status: 4.00, Cost: 1561.80, Comm 0.00
      2020-05-11 test Opened: PnL Gross 0.0, Net 0.0
      

      Any suggestion to change in the source code or any extra module I don't know of would be really appreciated.

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
      $(document).ready(function () { app.coldLoad(); }); }