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



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


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

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

(login for full post details)
  #1 (permalink)
CreativelyChris
Los Angeles, CA
 
 
Posts: 11 since Sep 2021
Thanks: 1 given, 0 received

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 futures io?
Book for fundamental analysis
Stocks and ETFs
NT8 Order Management Strategy
The Elite Circle
Anyone ever use "Seasonax" website?
Trading Reviews and Vendors
in depth understanding of last, bid, and ask volume in c …
NinjaTrader
Demo accounts order fill
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Is anyone actually making money?
52 thanks
An embarrassing, honest confession
37 thanks
Sierra vs. Ninja : why I chose .....
8 thanks
Institutional Grade Massive Data Dump for Quant Research …
5 thanks
Machine Learning Journal
5 thanks
 
(login for full post details)
  #2 (permalink)
 ABCTG   is a Vendor
 
 
Posts: 2,363 since Apr 2013
Thanks: 426 given, 1,579 received

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 Twitter Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > PSP Class - Can't any get Close value past [1]


Last Updated on February 7, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts