Hi everyone,
i think this post will be the first of many, since I'm a complete newbie in wealth lab, and using the programming guide to teach myself wealthscript:
http://personal.fidelity.com/products/pdf/wealthscript.pdfI'm having an issue with understand the BarInterval property. The guide above doesn't fully explain what is actually does, and I'm having trouble understanding this code:
CODE:
Please log in to see this code.
Could someone please explain to me what BarsInterval does and how it is being used in these ints. The easier the explanation the better, since English isn't my first language.
Thanks for the help in advance.
Size:
Color:
Welcome to the forums Anna.
Like with all documented methods and properties of the WealthScript namespace, the BarInterval property is explained in the built-in QuickRef tool (F11 key). Each property usually comes with its code example, if required.
Size:
Color:
Hi!
I also dont understand this example.
Question 1:
int exitTime = 1500 + 60 - Bars.BarInterval;
why is +60 stated? why not:
int exitTime = 1600 - Bars.BarInterval;
as 1560 (or 1600?) means the time, right?
Question 2:
In your actual WL programming guide (https://www.fidelity.com/bin-public/060_www_fidelity_com/documents/WLP_Programming_Guide.pdf)
there is an example on page 8, chapter 3.2
For me, it is unclear what Highest.Series(High, Period) is giving back. the quickRef states, that it is giving back the highest value of the period (series) as double
BUT
it seems that this function is giving back an array, as shown in the bottom of the example code with "BuyAtStop(bar+1, brackoutHigh[bar]);
Size:
Color:
#1 - 1600 means the time.
#2 -
Highest (or Lowest) is an indicator. You can find it in the Standard Indicators group. Click "More info" for syntax and an example (if available). And like absolutely any indicator, it returns a double value.
Size:
Color:
Dear Eugene,
#1
So the purpose of this example is JUST to show that 1500+60 means 16:00 o clock,right?
#2a
From didactic point of view, the examples in the programming guide is confusing and could be improved;
DataSeries breakoutHigh = Highest.Series(High, Period);
In this case, breakoutHigh is a DataSeries.
in case of
double lastHigh = Bars.High[Bars.Count - 1]
high is a double value. But in quickRef, the High Property is explained with
"Returns a DataSeries object that represents.."
but nor is it an object, nor a DataSeries, but just a double value, right? If lastHigh would be an object, it should be possible to access its methods with "." (dot) like lastHigh.method -> but there are no such methods.
#2b
What actually is DataSeries breakoutHigh = Highest.Series(High, Period) doing?
from developer point of view, if you expect an ARRAY of highest series of a specific period, the next question would be what are the hightest values of a period?
If my period has the following highs 1, 2, 3, 4, 5, 6
and i am taking out period 0-2 (so 1, 2, 3) highest should be 3, but then again it should not be an array, but just a double.
So, from beginners point of view, these construct of dataseries is confusing (and i guess this is also what Mrs Keyzer doesnt get..)
Size:
Color:
Hi Mathias,
QUOTE:
but nor is it an object, nor a DataSeries, but just a double value, right?
No need to make guesses. The QuickRef states it unequivocally: the
High property returns a DataSeries. Looks like you're confusing DataSeries (
arrays in your terminology) with their individual double values. As per the QuickRef, a
DataSeries object represents a series of values (double type) with corresponding dates.QUOTE:
What actually is DataSeries breakoutHigh = Highest.Series(High, Period) doing?
It is returning a DataSeries (see above).
QUOTE:
and i am taking out period 0-2 (so 1, 2, 3) highest should be 3, but then again it should not be an array, but just a double.
It is not an array. For a given bar, a
double value is returned by a DataSeries. Consequently,
Highest would return the highest value of a source DataSeries within the specified lookback period for that given bar. Our documentation is clear on what any function returns. Please start by reading the WealthScript Programming Guide > DataSeries >
Accessing a Single Value from a DataSeries.
QUOTE:
and i am taking out period 0-2 (so 1, 2, 3) highest should be 3, but then again it should not be an array, but just a double.
That's right, it's 3 and it's
not an array. It's the single value at the end of the time span (period from bar 0 to bar 2). The "array" (i.e. the part of the DataSeries object that contains
double values) represents a series of highest high values for each given bar.
QUOTE:
So, from beginners point of view, these construct of dataseries is confusing (and i guess this is also what Mrs Keyzer doesnt get..)
The construct should be precisely clear to the beginner who starts by reading the DataSeries chapter in the WS Guide.
Size:
Color: