For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
2019-10-02: The community is currently in read-only mode

Clarification Regarding Filters



  • I am working on a ML project and I use the strategy class for most of the preprocessing stuff.

    I have 2 clarification question that I couldn't find answer to:

    1. The examples I found so far used filters on the cerebro level (like resample or replay), but can I safely use filters on data in the strategy level?

    2. When applying a filter (let's say Resampler), does the filter get evealuated once at the start (to avoid repeatedly applying the same filter to the data)? and the last bar get evaluated on every next (to adjust the boundary of the resampled data to the latest known value)?


  • administrators

    @jacob said in Clarification Regarding Filters:

    1. The examples I found so far used filters on the cerebro level (like resample or replay), but can I safely use filters on data in the strategy level?

    No idea what you mean. Filters are applied to data. Strategies have nothing to do with filters.

    @jacob said in Clarification Regarding Filters:

    1. When applying a filter (let's say Resampler), does the filter get evealuated once at the start (to avoid repeatedly applying the same filter to the data)? and the last bar get evaluated on every next (to adjust the boundary of the resampled data to the latest known value)?

    If the filter only got evaluated once, it would be difficult to resample an entire set of data.



  • @backtrader said in Clarification Regarding Filters:

    No idea what you mean. Filters are applied to data. Strategies have nothing to do with filters.

    Maybe I should explain a bit what I'm doing and what I'm trying to accomplish.

    I'm experimenting with a deep learning library that use backtrader architecture as it backend server. The library take care of all the data feed part so the user entry level to the code is via 'strategy'.

    So I end up having one data feed given by the library, but I'm trying to work with a few variation of the data by introducing different filters.

    for example, let's say I'm trying to work with the original data and also a resampled version. normally in backtrader I would have used cerebro.adddata() for the first data and cerebro.resampledata(...) for the second.

    In my case I can modify only the strategy. so in the init I've tried making a clone() to the data and add a filter to it but It seem I lose the sync (probably because no one is advancing the pointer on next). If I just add the filter I lose the original data.

    is there a backtrader solution I can apply? adding the filtered data in a way it would still sync? or dynamically add and remove filters, so I can get one data result with filter and one without? maybe some workaround with filters and indicators?


  • administrators

    No, there isn't.



  • Check out Docs - Automating BackTesting.

    You can put the script part responsible for cerebro running into function and add parameters which will control filters, indicators, resample data etc.


Log in to reply
 

});