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

Trendline calculation

  • I'm newbie here. Just wonder if it's possible to calculate trendline from close price? If so, could anyone kindly point out what I should research.

  • @yxd0018 Welcome to backtrader! Can you provide a bit more details about what you are trying to do?

  • @run-out In the stock chart, instead of eyeballing the trend (up or down) and drawing the trendline for very obvious trend (higher high or lower low), is it possible to

    1. draw the trend line (upper & lower bond)
    2. develop indicator to see if current price is within the trend

    I understand this is not typical back testing question. I appreciate if you could redirect me to a more proper forum if there is one.

    Thank you.

  • @yxd0018 Good question. Backtrader has a good number of moving averages, bands, envelopes that you can use in your backtests. Have a look at this page and explore the indicators on the right hand side.

    The indicators will have a link to further explanation usually on wikipedia.

    Try implementing one, say bollinger bands. If you need help let us know.

Log in to reply