I'm just starting with trying to work with the PriceSeriesProvider (PSP) Class.
I wrote the following code, but I get an error as soon as I tried to change PSP1.Close to anything beyond 0 or 1. (Eventually I want to get the value for PSP1.Clsoe[14] or something similar).
What am I doing wrong here that prevents me from looking at the value for anything greater than Close[1]?
Can you help answer these questions from other members on futures io?
since PSPs load asynchronously your code might be trying to access values that are not yet present. As a safety net you can try checking the PSP has enough values using "PSP1.Count" before you access a certain index. For performance reasons you can use a boolean flag that you set to true once when the PSP has enough values. This way you avoid having to check this on every bar.
Depending on your MaxBarsBack setting it is also not guaranteed that the PSP holds 14 bars back when you try to access it on the first bar. The check mentioned above can help preventing the error message in that case, too.