Getting bars from lower timeframe
Author: bflotrader
Creation Date: 3/21/2013 10:50 PM
profile picture

bflotrader

#1
Is there a way if I'm using a daily timeframe to move to 30 min. timeframe in my code to get certain values.

I tried SetScaleCompressed(30); but I get the following error

Runtime error Cannot convert Daily Bars to 30 Daily Bars
profile picture

Eugene

#2
That's right. As you could read in the QuickRef, SetScaleCompressed only applies to intraday bar scales. You can not compress Daily bars into 30-day bars.

Fortunately, our Knowledge Base contains many helpful design patterns - and this one is for your case:

Accessing Intraday data from Daily
profile picture

bflotrader

#3
That worked perfect, thanks for the link!

The issue I'm running into now is an out of memory exception. This is happening because I'm trying to backtest on about 100 symbols and loading 5 min. bars for each of them on a daily timeframe (from 2004-2013) becomes too much.

I've tried loading the daily symbols, getting the couple of numbers I want, and then immediately disposing of them to free up memory, but that doesn't seem to help.

Is there a way, when calling the GetExternalSymbol to only get values for a particular time period (say one day's worth of 5 min. bar), instead of all the data in the dataset?
profile picture

Eugene

#4
Please consider going over tips in this FAQ: Out of memory problems
profile picture

bflotrader

#5
Following those tips helped alleviate some of the problems but I'm still not able to back test on as much data as I would like. If this is just something in going to have to deal with, that's fine. If I could only get 5min data for a specified timeframe though it seems like it might allow me to back test over a longer timeframe. Is it possible?
profile picture

Eugene

#6
GetExternalSymbol works as it's designed, and if there was a way to get only values for a particular time period, I'd suggest it to you right away (of course if you didn't leave me behind by finding it in the QuickRef on your own).

Disposing objects does not happen immediately, it might take time for the garbage collector for its driven by its own logic so to say.

The formula from the FAQ suggests that the OHLC DataSeries for your 100 symbols would consume at least 1 Gb. That figure would increase based on how much series your backtest actually creates, but it does not look like it's going to bring a typical PC with 8-16Gb RAM to its knees. How much RAM does your PC have and is it running 64-bit WLP?
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).