@barton05 said in Walk Forward Analysis Demonstration:
Thank you for your code, Barton05. When I run your code, I get NameError: name 'jsonConfigMap' is not defined. Could you tell mei how to fix it?
I was using the standard script for sample strategy, like below
if not ALPACA_PAPER:
broker = store.getbroker() # or just alpaca_backtrader_api.AlpacaBroker()
DataFactory = store.getdata # or use alpaca_backtrader_api.AlpacaData
data = DataFactory(dataname=symbol, historical=True, fromdate=datetime(2020, 10, 1), timeframe=bt.TimeFrame.Days)
The guy in your link didn't include fees & slippage.
Further more it should be noted that every single EMA combination tested (and most SMAs) outperformed the buy and hold annualized return of 6.32%^ during the test period (before allowing for transaction costs and slippage)Further more it should be noted that every single EMA combination tested (and most SMAs) outperformed the buy and hold annualized return of 6.32%^ during the test period (before allowing for transaction costs and slippage)
@Dennis-Musingila said in Some trades are executing while most are not:
ou can see that sometimes it skips months only to come back to them later how can i fix that
This would suggest that there's a problem with your data. Have you sorted the data by date correctly?
I'm using linode and it works well. You can custom select how powerful your server is but you need to get approved to use the dedicated servers to really get many cpus.
One note though, and I learned this the hard way, you have to kill your server completely when not in use or you keep paying, even if shut down. Create an image and just restart from the image everytime you use it.
This all still costs some money, but the time saving is enormous.
Ok I played around a bit and got it working:
from __future__ import (absolute_import, division, print_function,
# Import the backtrader platform
import backtrader as bt
lines = ('smaSlow','smaFast',)
params = (('periodSlow', 200),('periodFast', 100),('movav', bt.indicators.MovAv.Simple),)
plotinfo = dict(subplot=False)
plotlines = dict(
movavSlow = self.p.movav(self.data, period=self.p.periodSlow)
movavFast = self.p.movav(self.data, period=self.p.periodFast)
self.l.smaSlow = movavSlow #bt.Cmp(movav, self.data)
self.l.smaFast = movavFast #bt.Cmp(movav, self.data)
if self.lines.smaFast[-1] < self.lines.smaSlow[-1] and self.lines.smaFast > self.lines.smaSlow:
signal = True
signal = False
data should be bt data feed object. In your script data is a list of data feed objects, but not a single data feed object. Each data feed should be added to cerebro using separate adddata call. Search the forum, look up the docs and articles, this was discussed tons of times and described well.
@vbs thanks for the great work!
share some idears may better visualization
![alt text]( image url)
crosshairs all subplot(from here:link text)
click trade block to show trade messaage
![alt text]( image url)
This is a reasonably complicated indicator for a beginner. You should create a custom indicator.
Look here for further help: