Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. somebodyElse
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 0
    • Controversial 0
    • Groups 0

    somebodyElse

    @somebodyElse

    0
    Reputation
    7
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    somebodyElse Unfollow Follow

    Latest posts made by somebodyElse

    • Quickstart guide - results not as stated

      Hi,

      I am new to backtrader and tried out the samples in the quickstart guide.
      The sample for "Adding an indicator" (link) results in the following, according to the guide:

      Starting Portfolio Value: 1000.00
      2000-01-24T00:00:00, Close, 25.55
      2000-01-25T00:00:00, Close, 26.61
      2000-01-25T00:00:00, BUY CREATE, 26.61
      2000-01-26T00:00:00, BUY EXECUTED, Size 10, Price: 26.76, Cost: 267.60, Commission 0.00
      2000-01-26T00:00:00, Close, 25.96
      2000-01-27T00:00:00, Close, 24.43
      2000-01-27T00:00:00, SELL CREATE, 24.43
      2000-01-28T00:00:00, SELL EXECUTED, Size 10, Price: 24.28, Cost: 242.80, Commission 0.00
      2000-01-28T00:00:00, OPERATION PROFIT, GROSS -24.80, NET -24.80
      2000-01-28T00:00:00, Close, 22.34
      2000-01-31T00:00:00, Close, 23.55
      2000-02-01T00:00:00, Close, 25.46
      2000-02-02T00:00:00, Close, 25.61
      2000-02-02T00:00:00, BUY CREATE, 25.61
      2000-02-03T00:00:00, BUY EXECUTED, Size 10, Price: 26.11, Cost: 261.10, Commission 0.00
      ...

      When I run it, I get

      Starting Portfolio Value: 1000.00
      2000-01-24, Close, 24.10
      2000-01-25, Close, 25.10
      2000-01-25, BUY CREATE, 25.10
      2000-01-26, BUY EXECUTED, Price: 25.24, Cost: 252.40, Comm 0.00
      2000-01-26, Close, 24.49
      2000-01-27, Close, 23.04
      2000-01-27, SELL CREATE, 23.04
      2000-01-28, SELL EXECUTED, Price: 22.90, Cost: 252.40, Comm 0.00
      2000-01-28, OPERATION PROFIT, GROSS -23.40, NET -23.40
      2000-01-28, Close, 21.07
      2000-01-31, Close, 22.22
      2000-02-01, Close, 24.02
      2000-02-02, Close, 24.16
      2000-02-02, BUY CREATE, 24.16
      2000-02-03, BUY EXECUTED, Price: 24.63, Cost: 246.30, Comm 0.00
      ...

      There are two differences:

      1. Prices are different
      2. According to the guide, "Cost" for "sell" depends on the price for selling. When I run it, it is not, but has the same value as the "Cost" of buying.

      The quickstart guide seems out of date, which is a little concerning for a new users, because this could be a sign of low quality standards, at least regarding documentation.

      How does the correct code look? Is backtrader easy to use? Or is the quickstart guide just the tip of the iceberg of struggling until one gets it done?
      Thanks.

      posted in General Discussion quickstart
      S
      somebodyElse