开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

backstesting challenge with ScannerSubscription()


 

Hi,

I have implemented a breakout strategy in python with following steps:
  1. get stocks with class?ScannerSubscription() for a 13 weeks high or low
  2. calculate support/resistance for result of above scan result by adding contract details with?reqHistoricalData()
  3. select target stock by further calculations
  4. place the order
Above steps work fine but I can only test with live data because I found no way how I can execute step 1 only for data until a certain date so that I can use it for backtesting. For historical market data with reqHistoricalData() it works fine because I can filter for certain date

My question:
  • Can I do backtesting the way I planned it or is this not possible with?ScannerSubscription(). If not, are there other approaches how I can implement backtesting?

Many thanks
Robert


Nick
 

Just get historical data for 13 weeks (from any date) and calc the high and low yourself.

Do a little abstraction so a function Get13WeekHighLow will use a subscription when live and historical data when backtesting.

On 1/29/2022 2:43 PM, mount.bertl@... wrote:
get stocks with class?ScannerSubscription() for a 13 weeks high or low


Robert Anglberger
 

Thanks Nick - I will go for your solution