PreviousTradingDate throws exception on SetContext from another provider
Author: KGo
Creation Date: 12/15/2020 6:59 PM
profile picture

KGo

#1
The exception is object reference not set to an instance of an object in TradingDay from Community Components

It happens when there is bar data from another provider. Try Wealth-Data with Yahoo.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
This is by design. ^NDX is not a valid Wealth-Data symbol. It's Yahoo specific.
profile picture

KGo

#3
QUOTE:
^NDX is not a valid Wealth-Data symbol. It's Yahoo specific.


Correct. That's my intention. SetContext searches datasets alphabetically to find the symbol given. I routinely build backtests with symbols from different datasets and sometimes different providers.

Everything works as expected except subject function. Above is a simplification of a larger strategy to demonstrate the exception. Please give it a try.

If it truly is by WL design please give references to help me understand what else will not work. My main issue has been unavailable dividends. Thanks for you help.



profile picture

Eugene

#4
That TradingDay function from Community Components queries the Bars.MarketInfo.Holidays property. The Bars.MarketInfo object is null for the secondary symbol. As WL 6.9 is no longer developed and there's no possibility to fix anything in the thick client, we will have to live with this (until WL7 of course).

CODE:
Please log in to see this code.
profile picture

KGo

#5
QUOTE:
Bars.MarketInfo object is null for the secondary symbol
Good to know limitation. I'll write a workaround in the catch. Thanks for testing.
profile picture

Eugene

#6
Glad to help you figure out the source of error.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).