- ago
Hi
Is there a place where the equivalences of Wealth-Lab 6.9 vs 7 appear?
For example, I can't find the equivalent of "GetExternalSymbol" to call another symbol
For example, what would be the equivalence of this line of code from WL6.9 to WL 7?

CODE:
DataSeries sp500 = GetExternalSymbol ("Index", "^GSPC", true) .Close;


Thanks
1
1,573
Solved
13 Replies

Reply

Bookmark

Sort
Glitch8
 ( 12.10% )
- ago
#1
It would be GetHistory

And, we do have a burgeoning FAQ, but a page with more detailed equivalences is a great idea!

GetHistory
public BarHistory GetHistory(BarHistory synchWith, string symbol)
Lets you access data for another symbol from within your Strategy. Returns a BarHistory object for the specified symbol. The synchWith parameter specifies a BarHistory object to synch the historical data with. Generally, this will be the bars parameter from the Initialize or Execute method.

Also see GetHistoryUnsynched
1
Best Answer
- ago
#2
Thanks Glitch
0
- ago
#3
Hi.
I have used GetHistory and it works fine with symbols like SPY.

Indicator:

CODE:
//RSMansfield BarHistory sp500 = GetHistory (bars, "SPY"); TimeSeries serRelacion = bars.Close / sp500.Close; TimeSeries basePrice = SMA.Series(serRelacion, 52); TimeSeries rsMansfield = (serRelacion / basePrice - 1) * 10; PlotTimeSeries(rsMansfield, "RSCMansfield", "MansfieldPane", Color.Red, PlotStyles.Histogram);


Instead, if I use a symbol like "^ GSPC" that I have included in a custom DataSet using Yahoo as provider, I get the following error when I pass it through a list that has two values ​​(AMZN and AAPL). The error occurs regardless of the value you include in that list.

This is the errors log:

Initialize Exception (AMZN) Line 62 - Object reference not set to an instance of an object.
Initialize Exception (AAPL) Line 62 - Object reference not set to an instance of an object.
at (Object )
at WealthLab.Backtest.StrategyBase.FindUtils(BarHistory reference)
at WealthLab.Backtest.StrategyBase.GetHistory(BarHistory synchWith, String symbol)
at WealthScript3.MyStrategy.Initialize(BarHistory bars) in :line 62
at WealthLab.Backtest.UserStrategyExecutor.SortReg(List`1 symbols)


Line 62 of the error is:
"BarHistory sp500 = GetHistory (bars, "^GPSC");


If I change "GSPC" to "SPY" it works fine.
What could it be due to?
0
Glitch8
 ( 12.10% )
- ago
#4
Do you have Yahoo "checked off" as one of the Providers in the Data Manager, Historical Data Providers tab? This is what WL7 uses to determine which Providers to search through when you enter a symbol.
0
- ago
#5
Just to expand on Dion's answer, SPY is an example of a provider agnostic symbol while ^GSPC is Yahoo specific. When a symbol cannot be found, WL7 will look it up in whatever providers you have checked. It's much easier to find SPY because it's returned by Wealth-Data, QData, and most any other provider but ^GSPC cannot be found anywhere but in a Yahoo dataset.
0
- ago
#6
Thanks to both of you.
After checking the Historical Data Providers tab, it works.
Finally and to close the query.
In WL 6.9 it was possible to indicate the path of the DataSet to use. In WL 7 is it possible?
Example WL 6.9 to search the Dataset "DataSetName":
DataSeries sp500 = GetExternalSymbol ("DataSetName", "^ GSPC", true) .Close;
What would be the equivalence in WL7?
0
Glitch8
 ( 12.10% )
- ago
#7
Yes, it's possible, but you need to write a little more code. Possibly in the future we can provide a shortcut to do this like you can in WL6. Here's how you could achieve this in WL7 using some of its framework components:

CODE:
//Initialize public override void Initialize(BarHistory bars) {          DataSet ds = DataSetFactory.FindDataSet("Cryptos");          GetHistoryControlBlock cb = new GetHistoryControlBlock();          cb.DataSet = ds;          BarHistory btc = WLHost.Instance.GetHistory("BTC.USD", HistoryScale.Daily, DateTime.MinValue, DateTime.MaxValue, 0, cb);          btc = BarHistorySynchronizer.Synchronize(btc, bars);          PlotBarHistory(btc, "BTC", Color.SteelBlue); }
1
- ago
#8
Thanks Glitch.
Yes please, it would be great a shortcut to do it!
0
Glitch8
 ( 12.10% )
- ago
#9
There's an easier way that I had forgotten about ...

CODE:
//Initialize public override void Initialize(BarHistory bars) {          BarHistory aapl = IndicatorFactory.GetHistory(bars, "AAPL", bars.Scale, "BestData");          PlotBarHistory(aapl, "AAPL", Color.SteelBlue); }


Still, we can make this a proper WL7 method and document it in the QuickRef :)
1
- ago
#10
hello trying code from #7, I get.

DataSetFactory doesn't exist in current context

Any idea?? Thanks!
0
- ago
#11
Add:
CODE:
using WealthLab.Data;
1
Cone8
 ( 6.32% )
- ago
#12
Re: Is there a place where the equivalences of Wealth-Lab 6.9 vs 7 appear?

We started a topic in the Help file and will be adding to it. Enter "Version 6" in the Help filter and you'll see it.

Although, I'm thinking that a better way to go about this is to create another resource from WL6's QuickRef and add the WL7 equivalent there.
0
- ago
#13
Thanks Eugene #11, I forgot it.
Working!!
0

Reply

Bookmark

Sort