ww58
- ago
I used ScaleInd and faced a situation when weekly bar collected from 30m bars does not coincide with the one collected from daily bars, because of bad 30m quotes. One of the solutions I see is a feature request to add source of bars for this indicator (may be to SymbolInd too), that it would be possible to specify the daily timeframe in it. Are there any other solutions?
0
90
Solved
3 Replies

Reply

Bookmark

Sort
Cone8
 ( 25.44% )
- ago
#1
Re: "bad 30m quotes".
I guess you mean bad data for a 30 minute bar. Why was the data bad?
The solution to bad data is good data.

Also, what do you mean by "coincide"? The Intraday close of a session will OFTEN not equal the Daily close because the latter is the settled close and the former is simply the last full-lot trade for the session. They're often the same, but the values can be different, by design.
1
ww58
- ago
#2
I'll explain it better with an example. Suppose we want to get a weekly pivot for ENPH on April 2, which is (H+L+C)/3 of the previous weekly bar = 118.21 on wealth-data quotes. This is the price we also get using ScaleInd from 30m bars using Alpaca quotes, but on IB quotes the price is 117.31. This is a problem in the IB quotes, but since we have great wealth-data quotes I would like to be able to use them in such case.
0
Cone8
 ( 25.44% )
- ago
#3
IB's intraday data for ENPH on 3/28 looks bad - doesn't reflect reality, and, it doesn't even match IB's own Daily data. If you're looking for something in the Weekly scale, it would be better to use Daily anyway.

The question is what are your constraints?

If your using C# Code, you can use the WLHost.Instance.GetHistory() to get the history from a Daily source, and pass that to your ScaleInd for the Weekly bars. Actually, you can just specify the Weekly Scale in that call and it should automatically create it from Daily bars.

This should work -
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 {       private TimeSeries _pivot;        public override void Initialize(BarHistory bars) {          BarHistory wkly = WLHost.Instance.GetHistory(bars.Symbol, HistoryScale.Weekly, DateTime.MinValue, DateTime.MaxValue, 0, null);          _pivot = TimeSeriesSynchronizer.Synchronize(wkly.AveragePriceHLC, bars);          PlotTimeSeriesLine(_pivot, "Pivot", "Price");           } public override void Execute(BarHistory bars, int idx) {       } } }
1
Best Answer

Reply

Bookmark

Sort