- ago
Is there a way (using WL8 now) for WL to store/process the array of OHLCV data for a single ticker in 2 different time frames (for instance 1-min and 30-min), and if so, can it be plotted (maybe with 2 different volume panes, since they will obviously be different scales, but price could remain on the same pane)? I know that in WL6.9 the context could get changed to accomodate different time frames. My thought was to execute quickly (1 minute time frame), but make decision-making on a less "twitchy" trigger (30-min time frame).
Thanks
0
885
Solved
6 Replies

Reply

Bookmark

Sort
- ago
#1
Yes. TimeSeriesCompressor / TimeSeriesSynchronizer in the QuickRef has some code examples.
0
Best Answer
- ago
#2
thanks Eugene. Will check it out. Now I see the example code under synchronize. Appreciate it!
0
- ago
#3
Sorry to bother. I'm sure there's something really simple I'm missing. When I try to set the Bar color (kind of like traditional Volume bars), the program seems to run in infinite loop (never finishing). How do I fix it? All I did was add a loop for SetSeriesBarColor:

CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; using System.Drawing; namespace WealthScript3 {    public class MyStrategy1 : UserStrategyBase    {       //create indicators and other objects here, this is executed prior to the main trading loop       public override void Initialize(BarHistory bars)       {          //get weekly closing price          TimeSeries Close30 = TimeSeriesCompressor.ToMinute(bars.Close, 30,bars.Market);          TimeSeries Volume30 = TimeSeriesCompressor.ToMinute(bars.Volume, 30, bars.Market);          //calculate RSI          RSI rsi30min = RSI.Series(Close30, 13);          RSI rsi01min = RSI.Series(bars.Close, 20);          //expand it back to daily scale          TimeSeries expandedRSI = TimeSeriesSynchronizer.Synchronize(rsi30min, bars);          TimeSeries expandedVol30 = TimeSeriesSynchronizer.Synchronize(Volume30, bars);          TimeSeries expandedClose30 = TimeSeriesSynchronizer.Synchronize(Close30, bars);          //plot it          PlotTimeSeries(rsi01min, "RSI", "RSI", WLColor.DarkGreen);          PlotTimeSeries(expandedRSI, "RSI30", "RSI", WLColor.Blue);          PlotTimeSeries(expandedClose30, "Close(30 min)", "Price", WLColor.Blue);          for (int i = 1; i < bars.Count; i++)          {             SetSeriesBarColor(expandedVol30, i, expandedClose30[i] > expandedClose30[i - 1] ? WLColor.Green : expandedClose30[i] < expandedClose30[i = 1] ? WLColor.Red : WLColor.Black);          }          PlotTimeSeries(expandedVol30, "Vol(30 min)", "Vol 30 min");       }       //execute the strategy rules here, this is executed once for each bar in the backtest history       public override void Execute(BarHistory bars, int idx)       {       }       //declare private variables below    } }
0
- ago
#4
I notice this behavior too, doesn't look expected to me.
0
- ago
#5
Dion found a bug in your code, it makes an assignment ("=") instead of subtraction:

CODE:
//SetSeriesBarColor(expandedVol30, i, expandedClose30[i] > expandedClose30[i - 1] ? WLColor.Green : expandedClose30[i] < expandedClose30[i = 1] ? WLColor.Red : WLColor.Black); SetSeriesBarColor(expandedVol30, i, expandedClose30[i] > expandedClose30[i - 1] ? WLColor.Green : expandedClose30[i] < expandedClose30[i - 1] ? WLColor.Red : WLColor.Black);
0
- ago
#6
thanks guys! I just couldn't find that something simple!
0

Reply

Bookmark

Sort