ww58
 ( 0.00% )
- ago
On the left is a chart from TradingView for May 23 2025, on the right is the chart from the WL on NQ ASCII dataset. The intraday data is the same (with an adjust correction), but the program treats this day as two separate days, even though both brokers and TradingView combine the following two days into one.


Then I tested it in a different way, I ran it on daily bars and compared the results. Though I’m not sure that this method is correct.

CODE:
using WealthLab.Backtest; using WealthLab.Core; namespace WealthScript5 { public class MyStrategy : UserStrategyBase { public override void Initialize(BarHistory bars) {          BarHistory intraday = WLHost.Instance.GetHistory(bars.Symbol, HistoryScale.Minute30, bars.StartDate.AddDays(-1), bars.EndDate, 0, null);          BarHistory daily = BarHistoryCompressor.ToDaily(intraday);          PlotBarHistory(daily, "Price", WLColor.Magenta.SetAlpha(100));       } public override void Execute(BarHistory bars, int idx) { } } }

0
47
2 Replies

Reply

Bookmark

Sort
Cone8
 ( 23.46% )
- ago
#1
1. You must Synchronize after compressing if you plan to work/plot with the chart's bars.

2. Daily bars will differ from what you synchronize by time with intraday trading - especially for globex futures with IB.
Don't ask me where or when they get their globex closing price from - I can't figure it out.

3. Anyway, run it with Synchronization on intraday bars. You'll see the Daily bar change at 4pm (assuming CME market time).

CODE:
      BarHistory intraday = bars; // 30-minute or any intraday chart          BarHistory daily = BarHistoryCompressor.ToDaily(intraday);          daily = BarHistorySynchronizer.Synchronize(daily, bars);          PlotBarHistory(daily, "Price", WLColor.Magenta.SetAlpha(100));

You just have to decide if you want to use your own real-sychronized prices based on actual trading, or the ones IB makes up from who knows where?
0
ww58
 ( 0.00% )
- ago
#2
I am aware of Synchronize, but that's not the reason. Let's measure another way.
CODE:
BarHistory intraday = WLHost.Instance.GetHistory(bars.Symbol, HistoryScale.Minute5, bars.StartDate, bars.EndDate, 0, null); BarHistory daily = BarHistoryCompressor.ToDaily(intraday); for (int i = 0; i < daily.Count; i++)    WriteToDebugLog($"{daily.DateTimes[i].ToShortDateString()}, {daily.Open[i]}, {daily.High[i]}, {daily.Low[i]}, {daily.Close[i]}");
That's what we get

OHL prices match in most cases, but on some days WL counts two days when all other services (I double checked several) count one. Apparently, this is something specific to the futures market.

And IB really counts daily bars strange. I'll stick with the compressing option, but as long as there is a problem with the extra day, that's not a solution either.

Upd: On Nov 25, the High also differs significantly
0

Reply

Bookmark

Sort