Intraday / Multi-Time Frame | Accessing Intraday data from Daily

Modified on 2015/07/26 12:59 by Eugene — Categorized as: Knowledge Base

The request

Sometimes, we get requests like this or that where you ask to code an indicator that is built on intraday data but the strategy should be executed on daily data.

Although the request is somewhat backwards from the traditional way of mixing scales, it's still possible as the following solution by Robert Sucher illustrates:

The solution

Normally, as the WealthScript Programming Guide instructs to in Multi-Time Frame Analysis, one starts with an intraday chart (the base time frame), create intraday and Daily indicators, and program it such that it trades EOD only. There are more possibilities in Version 6 for accessing data for the same symbol in different scales.

Below is an example of how to calculate and access a 30-min StochD in a Daily chart. As can be seen, the key is to use a GetExternalSymbol overload (QuickRef for more: hit F11) that allows to specify the DataSet with intraday data that will be searched when an external symbol is requested.


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Access the symbol from a DataSet whose base scale is intraday. Do not synch yet! Bars intra30 = GetExternalSymbol("Dow 30_30", Bars.Symbol, false); // Apply the indicator in the intraday scale DataSeries sto_intra30 = StochD.Series(intra30, 15, 3); /* Work-around for synch issue - we have to account for native synch erroneously delaying the intraday bars by one day in the following step. Advance the intraday bars by one day. The simple shift method only works if no short days are included in the series and you can guarantee that an intraday bar exists for each period of the day. Otherwise this step is more complicated. */ sto_intra30 = sto_intra30 << 13; // 13 30-min bars in a standard trading day // Synchronize to the chart scale (Daily) sto_intra30 = Synchronize(sto_intra30); // Plot the result. // You'll see the last value of the day for the 30-minute indicator for each day ChartPane stoPane = CreatePane(40, true, true); PlotSeries(stoPane, sto_intra30, Color.Green, LineStyle.Solid, 2); } } }