- ago
I noticed that if the traded symbol is loaded from the strategy code, then I did not find a way to reload it, except restarting WL. For example:
CODE:
      public override void Initialize(BarHistory bars)       {          SPY = GetHistory(bars, "SPY"); ...       }


if the strategy trades on SPY, and I change the data provider, and click on the lower left corner of the strategy window to force reload symbols. The SPY data will not be reloaded. The following shows the result after I switched from Norgate data to WL data and you can see the execution price for some trades are outside of the daily ranges since SPY data for those days for the two data sources are different.


How does one force reload bar data that's coded in a strategy?
0
175
5 Replies

Reply

Bookmark

Sort
Glitch8
 ( 9.28% )
- ago
#1
You’d have to restart WL8.
0
- ago
#2
QUOTE:
How does one force reload bar data that's coded in a strategy?

If you hit the lighting bolt button, that should reload the entire Chart, or at least the current symbol. But I got your point; that feature should be documented with a ToolTip. I agree.
0
- ago
#3
@Glitch: is this something that can be improved?
0
- ago
#4
@superticker: that does not work for me.
1
- ago
#5
@rainfield - try the following code. You could add it to each strategy, your own helper library in a helper class, or as an extension method (with a tiny change) for BarHistory.

CODE:
public static BarHistory ForceGetHistory(BarHistory strategyBars, string symbol) =>          BarHistorySynchronizer.Synchronize(strategyBars.GetDataProvider()             .GetHistory(symbol, strategyBars.Scale, strategyBars.StartDate, strategyBars.EndDate, int.MaxValue, null), strategyBars);

To use it from your Initialize() method...
CODE:
var SPY = ForceGetHistory(bars, "SPY");

This worked for me testing with symbol SPY, without restarting Wealth-Lab, as I switched the first data provider between Alpaca, NASDAQ, QData, Yahoo, and Schwab. It didn't work if I switched to WealthData, and I don't know why.

0

Reply

Bookmark

Sort