Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
112 views

I have this below code that calculates DEMA [Double Exponential Moving Average] based on the close price import backtrader as bt import pandas as pd class CalculateDema: def __init__(self, data, ...
Satheesh Kumar's user avatar
0 votes
1 answer
228 views

before I start backtesting, may I hold some stock share? As I can set cash at the begining, can I set a stock share like this? cerebro.broker.set_position(size=10, price=100)
Alightor Li's user avatar
2 votes
0 answers
205 views

How to add new data and run again after running in Backtrader? cerebro = bt.Cerebro() df = pd.read_csv('data.csv') data = bt.feeds.PandasData( dataname=df ) cerebro....
G_will's user avatar
  • 21
2 votes
0 answers
207 views

I have historical stock data from Norgate that I'd like to use with Backtrader. Of course, the stocks that I'd like to use all have different start and end dates that they've been listed. When I try ...
user3328887's user avatar
1 vote
0 answers
98 views

I have run two tests which clearly explain the scenario. Please see code block below of notify_order and notify_trade. **Test 1 (execute only 1 sellstop order): ** When I solely execute a sellstop ...
Pierre Cilliers's user avatar
0 votes
1 answer
192 views

I found a problem when using the backtrader EMA indicator to calculate the values. The larger the period value input( ex. 120days ), the greater the difference between the value of the EMA displayed ...
Tod's user avatar
  • 13
2 votes
0 answers
265 views

i am placing a buy order in my next() method of strategy and in notify order after checking if it is completed i am placing two orders (profit and loss) def notify_order(self, order): "&...
Pritam Jinal's user avatar
-1 votes
1 answer
865 views

I try to backtest my strategy of trading that is named "AI reversal". Light-weight implementation is available in strategies and I checked the document of backtrader to be right. But ...
Alex Hebra's user avatar
0 votes
1 answer
444 views

I m starting out with backtrader. I can load data into the object but plotting fails with a strange error message. I can create an object with sample data, like so: import pandas as pd import numpy as ...
Nik Vh's user avatar
  • 1
0 votes
2 answers
2k views

The Data I am using is throwing a Attribute Error: [*********************100%***********************] 1 of 1 completed Traceback (most recent call last): File "C:\Users\Navid\AppData\Roaming\...
Navid Yaghmaei's user avatar
0 votes
1 answer
1k views

I am trying to get a plot to show with some test code in VSC. I have version 3.2.2 of Matplotlib installed, as that is stated in Backtrader's documentation to be the compatible version. I am running ...
BobWeAddaBaby's user avatar
0 votes
4 answers
418 views

import backtrader as bt import pandas as pd # Load data file_path = r'C:\forex\python\data\EURUSD1min-v2.xlsx' data = pd.read_excel(file_path) # Handle date and time in separate columns data['...
Puma U's user avatar
  • 1
0 votes
1 answer
146 views

I wand to add custom plot elements e.g. a box between buy and sell trades. The axis ax is normally created like this: fig, ax = plt.subplots() How can I access it in Backtester's plot? ax =...
aiv's user avatar
  • 105
0 votes
1 answer
360 views

I can plot with the test data (2005-2006-day-001.txt) when read all columns. My code is as follows: import backtrader as bt class St(bt.Strategy): def __init__(self): self.sma = bt....
Doodle-loo's user avatar
0 votes
0 answers
78 views

I've noticed that every example and doc and reference about backtrader never calls super(ClassName, self).__init__() in derived class, which is different from common use. For example, when I want to ...
Tong ZongYang's user avatar

15 30 50 per page
1
2 3 4 5
8