- ago
Let's say I have a simple strategy like the following, set to use a Data Scale of 1 minute:



Is it possible to have WL8 execute the strategy at a custom interval, such as every 30 seconds? The "Lowest(Low, 20)" would still only be evaluated once every minute.

I don't mind converting to a coded strategy and making modifications if necessary. Just curious what the best way to go about it would be, if it's possible.
0
404
Solved
5 Replies

Reply

Bookmark

Sort
- ago
#1
Maybe I was approaching the problem backwards. Could I accomplish the above goal by setting "Date Scale: Custom (30 seconds)" and changing the following code so that the indicator is only evaluated once per minute?

0
- ago
#2
QUOTE:
so that the indicator is only evaluated once per minute?

No, you have to switch the data scale to 30 seconds.
0
Cone8
 ( 24.99% )
- ago
#3
QUOTE:
Is it possible to have WL8 execute the strategy at a custom interval, such as every 30 seconds?
Yes, the chart bars need to be 30-second bars.

QUOTE:
The "Lowest(Low, 20)" would still only be evaluated once every minute.
Every series would be "evaluated" on every bar, but if you use the TimeSeriesSynchonizer to create a 1-minute series in a 30-second chart, then it only changes once per minute. See TimeSeriesSynchronizer and BarHistorySynchronizer.

You're barking up the wrong tree with that code in NewWFOInterval. That method should be used to regenerate indicators during Walk-Forward Optimizations.
1
Cone8
 ( 24.99% )
- ago
#4
Stand by on using TimeSeriesCompressor/Synchronizer - I was working up an example for you but it appears that compression is not currently supported for source intervals below 1 minute.

Edit -
I think we can make second intervals to compress to minutes without too much effort, so you can look for that in Build 31 and run this code example -

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript123 { public class MyStrategy : UserStrategyBase { //create indicators and other objects here, this is executed prior to the main trading loop public override void Initialize(BarHistory bars) {          // lowest 20-bar low for base interval (30-sec)          TimeSeries lowestbase = Lowest.Series(bars.Low, 20);                             // create the compressed 1 minute series in          TimeSeries low1min = TimeSeriesCompressor.ToMinute(lowestbase, 1, bars.Market);                    // now expand the series so that it can be evaluated in the 30-second chart          _LL = TimeSeriesSynchronizer.Synchronize(low1min, bars);          PlotTimeSeries(_LL, "LL(20)", "Price");           } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) {          // use _LL here...           if (!HasOpenPosition(bars, PositionType.Long)) { //code your buy conditions here } else { //code your sell conditions here } }       TimeSeries _LL; } }
2
Best Answer
- ago
#5
Thank you, greatly appreciated!
0

Reply

Bookmark

Sort