NexusFi: Find Your Edge


Home Menu

 





PSP Class - Can't any get Close value past [1]


Discussion in EasyLanguage Programming

Updated
    1. trending_up 4,347 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
CreativelyChris
Los Angeles, CA
 
Posts: 13 since Sep 2021
Thanks Given: 1
Thanks Received: 0

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]?


 
Code
using elsystem ;
using tsdata.common ;
using tsdata.marketdata ;

var: PriceSeriesProvider PSP1(null), TestValue(null);

Input: SecondSymbol("SPY");

once
	begin
	PSP1 = new PriceSeriesProvider ;
	PSP1.Symbol = SecondSymbol ;
	PSP1.Interval.ChartType = DataChartType.Bars ;
	PSP1.Interval.IntervalType = DataIntervalType.Daily ;
	PSP1.Interval.IntervalSpan = 1 ;
	PSP1.Range.FirstDate = 
	DateTime.FromELDateAndTime( Date[MaxBarsBack], 
		Time[MaxBarsBack] ) ; 
	PSP1.Realtime = true;
	PSP1.Load = true ;
	end ;

TestValue = PSP1.Close[14];

plot1(TestValue, "PSP Close");


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
CME Launches Bitcoin Volatility Futures June 1 -- First …
Cryptocurrency
Without Pulisic, USA 61.5% Live vs. Australia -- France …
Prediction Markets & Event Contracts
US Prop Firms Race Inside the CFTC Perimeter -- Tradeify …
Funded Trading Evaluation Firms
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
Q1 2026 Shatters All Derivatives Volume Records -- CME H …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
BERN ALGOS algo trading journal
8 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

CreativelyChris,

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.

Regards,

ABCTG


CreativelyChris View Post
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]?


 
Code
using elsystem ;
using tsdata.common ;
using tsdata.marketdata ;

var: PriceSeriesProvider PSP1(null), TestValue(null);

Input: SecondSymbol("SPY");

once
	begin
	PSP1 = new PriceSeriesProvider ;
	PSP1.Symbol = SecondSymbol ;
	PSP1.Interval.ChartType = DataChartType.Bars ;
	PSP1.Interval.IntervalType = DataIntervalType.Daily ;
	PSP1.Interval.IntervalSpan = 1 ;
	PSP1.Range.FirstDate = 
	DateTime.FromELDateAndTime( Date[MaxBarsBack], 
		Time[MaxBarsBack] ) ; 
	PSP1.Realtime = true;
	PSP1.Load = true ;
	end ;

TestValue = PSP1.Close[14];

plot1(TestValue, "PSP Close");


Follow me on X Reply With Quote




Last Updated on February 7, 2022


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts