@vladisld said in StrategySkipError exception:
Docs - Exceptions - https://www.backtrader.com/docu/exceptions/
That's the specific documentation for the exception and it clearly shows it is done during __init__
@vladisld said in StrategySkipError exception:
Am I wrong?
No, it is shown in the docs.
@Ronan-Dunham said in backtrader data same for 5days vs 50 days:
On this code 5 days of data or 50 dys of data it returns the same data point.
The statement may make sense to you because you are deep in your problem, but it makes no sense to me. It seems to indicate, but this is only a guess, that the amount of downloaded data, even if you change your days_to_cross variable, doesn't change.
It may all be related to the alpaca API, which I personally don't know how to use or how it works.
I seem some failing logic here.
A half-bracket is applied (only main order and stop order)
main order is executed and stop is activated
trade opened by main order is closed by a non-related order
the stop order remains (as expected and as it would happen in real-life) active
It seems pointless to use a half-bracket to open the stop if the functionality of the bracket is ignored.
In any case the bracket code gives you a reference to the orders which are created. When your foreign order closes the trade, you simply have to use the reference you have for the the stop order and call self.cancel(stop_order)
To me it would seem sensible to try a from parameter.
The problem is the limit=6, which seems arbitrary. Backfilling is difficult, because you may know what you want, but APIs have to cope with facts like non-trading hours. That's why you usually says from => to and get the number of bars that are available, regardless of non-trading days and non-trading hours.
@Tim-Brug said in Plotting Problems:
How do I get access to the portfolio time series information directly?
What's exactly the meaning of portfolio time series? A "per-timestamp record of the portfolio value"? If so, that's not stored.
You would need to plug in an analyzer which records that.
@swibby Hey did you ever find a solution to this? I have been plugging in the spread (ask - bid) as the open-interest value as this always yields the most recent value (see dataseries.py, line 206) which is what you would want when making decisions/ penalizing based on the spread and resampling to higher timeframes
The calendars are not there to filter out some data points for you. Second sentence in the documentation for calendars:
This is useful when resampling in for example the following scenarios
From: Docs - Trading Calendar - https://www.backtrader.com/docu/tradingcalendar/tradingcalendar/
If you provide data that has price points for day X and you want to consider this a non-trading day, you will have to manually do it.
You may remove the "non-trading" days by implementing a specific filter
Docs - Filters - https://www.backtrader.com/docu/filters/
You can always read a CSV as a data feed and use the value as an indication to trigger something.
Given the lack of information about the content of the CSV (timestamp or not, for example) it is difficult to judge if that's the best way.
The same is true for a "webhook". Just like a data feed for Interactive Brokers waits for events to feed the data to the strategy, a data feed could wait for a "webhook".
I am revisiting this old thread as it seems to be a good jumping off point for a problem I'm stuck on. How might we extend this code to incorporate multiple unique symbols?
@backtrader said in Strategy execution on different timeframes and multi-data:
next is called for any tick which any data produces. Concentrating on a specific data is a matter of looking at the len of the data.
When the len of the data changes (it will always go up) you know you got a tick of that data
self.lendata1 = 0
if len(self.data1) > self.lendata1:
self.lendata1 += 1
I am trying to run a test across multiple symbols by evaluating trade signals on one time frame and completing executions on another.
When using the aforementioned code within an enumeration, only trades for the first added data feed are acted upon.
This is a snippet of the code I am working with, which parallel's that @backtrader outlines above:
self.datas.len = 0
for i, d in enumerate(self.datas):
if len(self.datas) > self.datas.len:
self.datas.len += 1
It seems like something else needs to be done other than just wrapping this in enumerate(). I have tried many different versions and have been stuck on this problem for the last several weeks, so any help is appreciated. If needed, I can create a unique thread for this problem.
Everything is a valid indicator. I simply said the "concept" is different because it is studying what has happened and not what is "actually" happening.
You may of course signal at instant  and react accordingly, but the event will still have happened in the past.
You are for sure using:
Without looking at the code I would dare to say that the store doesn't re-open the connection simply because you update a couple of attribute members whilst trading.
You will have to ask the author(s) to add a method to do such a thing, something like this from within the strategy
and have this method creating a new connection to Oanda which will replace the existing one.