edwkelly8
 ( 0.06% )
- ago

Build 31 - February 10, 2023
Fix - TimeSeriesSynchronizer correctly aligns an intraday TimeSeries to a Daily+ TimeSeries, putting the Daily+ value on the last bar of the intraday series for that date.

This fix has completely broken my code. Please send me a link to re-install build 31.

For my code to work, I must have the last intraday value assigned to the last intraday bar. As it is now, the last intraday bar and previous intraday bar have the same value.
0
688
Solved
19 Replies

Reply

Bookmark

Sort
Glitch8
 ( 12.83% )
- ago
#1
Hi Ed, I'm thinking your code might have relied on the faulty synching that we fixed. Can you post or send your strategy or a minimal use case that we can see? Below here is an example of correct syncing, the daily bar should only be synced to the LAST intraday bar of the day.

30-minute scale used.

CODE:
using WealthLab.Indicators; using System.Collections.Generic; namespace WealthScript1 { 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) {          BarHistory daily = BarHistoryCompressor.ToDaily(bars);          TimeSeries expand = TimeSeriesSynchronizer.Synchronize(daily.Close, bars);          PlotTimeSeries(expand, "Sync", "Price", WLColor.Blue, PlotStyle.Dots); } //execute the strategy rules here, this is executed once for each bar in the backtest history public override void Execute(BarHistory bars, int idx) { } } }


0
edwkelly8
 ( 0.06% )
- ago
#2
The short of the use case is that I create an intraday chart of an etf. A strategy is dropped onto the chart, call it EtfStrategy. Then from the Strategy Monitor, I read the eft's N constituent stocks (500+ stocks) using another strategy, call it StreamStrategy. After a delay to allow Strategy Monitor to read the N constituent stocks (using IQFeed) and posting their Bar Histories to SetGlobal, EtfStrategy (using GetGlobal) does a bar by bar or multibar by multibar analysis of the eft's movement against the movement of each constituent stock over the data range.

The code in EtfStrategy that matters is:
CODE:
BarHistory bh = (BarHistory)_Score.GetGlobal(key); //this is a single constituent stock coming from a 500+ foreach loop TimeSeries symCloses = TimeSeriesSynchronizer.Synchronize(bh.Close, _Bars.Close, 0, null); //Bars.Close is the etf


At this point I should now have the eft data time synched with the stock's data. But, with the change I am getting the last bar close equal to the previous bar close which just won't work for me.

I can't post pics since it's now after hours and Strategy Monitor won't read the data I need. But, without the last intraday bar and previous intraday bar having their correct values as it was in build 30, I just can't continue. So, in the meantime, please send a link to build 30.

Thanks
0
Glitch8
 ( 12.83% )
- ago
#3
Can you email us at support@wealth-lab.com and we can get Build 30 to you. You’ll need to uninstall WL before installing an earlier build.

And we’ll have to probably create a custom method for you to get back the “incorrect” values.
0
edwkelly8
 ( 0.06% )
- ago
#4
Thanks Dion,

Please keep in mind, for me these are correct values.

I am not compressing anything. The chart strategy and SM strategy are the same scale.

WL will not do this scheme any other way or I would do it. Try it for yourself using a chart and sm strategy. The last and previous bars passed from sm to chart have the same values.
0
Cone8
 ( 22.68% )
- ago
#5
Did you upgrade to IQFeed Build 11?

If yes, did you do the required upgrade to IQFeed client to 6.2 too? Check Programs and Features for the IQFeed Client version 6.2.0.25.

If you're using Provider Build 11 with IQFeed Client version 6.1, this is the problem.
0
edwkelly8
 ( 0.06% )
- ago
#6


Not sure what Provider Build 11 is?
0
edwkelly8
 ( 0.06% )
- ago
#7
I sent an email to support@wealth-lab.com requesting Build 30.
0
Cone8
 ( 22.68% )
- ago
#8
It's WealthLab's IQFeed Provider (Connector) -
https://www.wealth-lab.com/extension/detail/IQFeed

Anyway, you were already using 6.2, so that wasn't it.

But I'm suspicious of a problem with Streaming. If you weren't actually streaming (polling for example), your external updates for the most recent bar wouldn't be available. This would have the effect of a repeated previous bar.
0
edwkelly8
 ( 0.06% )
- ago
#9
For the streaming strategy I have always used "Use Streaming Data" with the same Scale and Data Range as the chart strategy. Prior to build 31, it has worked fine.
0
- ago
#10
QUOTE:
I sent an email to support@wealth-lab.com requesting Build 30.

We got you covered.
0
edwkelly8
 ( 0.06% )
- ago
#11
Since I cannot go forward with your updates because my issue has not been addressed in your latest release, please advise on my options?
0
Glitch8
 ( 12.83% )
- ago
#12
It seems like your code was based on a flaw in synchronization. If you want to get back to the old, flawed, synchronization maybe we can provide you an old version of the synchronizer. Write us at support@wealth-lab.com.
0
edwkelly8
 ( 0.06% )
- ago
#13
QUOTE:
No, we do not modify older builds. If you have any questions please use the forum.


Above was the response I just received from my request.

I am not asking for any changes to a previous build. I am asking for what you've suggested.

I do not know how to be any more clear.
0
Cone8
 ( 22.68% )
- ago
#14
I read your Post #2 and am very familiar with the technique. It should work.
Please show me your the StreamStrategy code that you're using to save the BarHistories to Global.
0
- ago
#15


Every change breaks someone's workflow 🤦‍♂️

We had provided you the link for B30 long ago, it's expired forever by now I guess. What's required?
1
Cone8
 ( 22.68% )
- ago
#16
There's no reason it should not work.
My code works.

I want to see all of Ed's code - this is where the problem is.

0
Glitch8
 ( 12.83% )
- ago
#17
Hi Ed,

Write support@wealth-lab.com and we can work with you to install the flawed synchronizer in your strategy to get the same results you were getting before.
0
Cone8
 ( 22.68% )
- ago
#18
Ed, I'd prefer to that you worked with me because I'm quite certain that the problem is in your strategy. We can fix it. I just worked on another issue with another customer who was certain there was a bug in WealthLab, but really the problem was elsewhere.

Probably you can just implement this (edit the key logic to match yours) and you'll see that it works.

CODE:
      // returns the synched or unsynched BarHistory for the symbol-scale if found in global memory       // allows up to 5 seconds to return       private BarHistory GetHistoryGlobal(string symbol, BarHistory sourceBars, bool syncToSource = true, double maxSeconds = 5)       {          BarHistory symBarsRaw = null;          DateTime symLastDate = DateTime.MinValue;          string gkey = symbol + "," + sourceBars.Scale.ToString();          DateTime start = DateTime.Now;          do          {                         if (HasGlobal(gkey))             {                symBarsRaw = (BarHistory)GetGlobal(gkey);                if (symBarsRaw?.Count > 0)                {                   if (symBarsRaw.DateTimes[symBarsRaw.Count - 1] == sourceBars.DateTimes[sourceBars.Count - 1])                      break;                }                System.Threading.Thread.Sleep(10);             }                                  } while ((DateTime.Now - start).TotalMilliseconds < maxSeconds * 1000); // 5 seconds max          if (syncToSource)          {             return BarHistorySynchronizer.Synchronize(symBarsRaw, sourceBars);          }                    return symBarsRaw;                                    // these bars are unsynched       }
0
Best Answer
edwkelly8
 ( 0.06% )
- ago
#19
Cone, I'm not in my office will get try this and get back this evening. Thanks
1

Reply

Bookmark

Sort