I get errors from the following code, if I try to make the "barToo" an int type.
I would have thought the purpose of the subject indicators are, to discover a bar number, so one can retrieve other values associated with that bar.
However, C# will not convert FROM double TO int.
CODE:
Please log in to see this code.
The above debug statement returned
CODE:
Please log in to see this code.
on July 30, 2013, when run on AAPL stock.
Clearly the numbers match, but the types don't.
Am I missing something?
TIA
Eb
Size:
Color:
With the cursor after
LowestBar.Value use Ctrl+Sft+Space. It shows up as type double.
Try;
CODE:
Please log in to see this code.
Size:
Color:
Also in its online documentation,
LowestBar:
CODE:
Please log in to see this code.
QUOTE:
However, C# will not convert FROM double TO int.
A double can not be equal to integer without converting with
Convert.ToInt32 (and rounding) or casting with
(int) (and truncating) first because a double may contain a floating point value.
Size:
Color:
Size:
Color:
Eb, this is not going to work. Just follow streak's suggestion.
Size:
Color:
With a slight modification, it did work:
CODE:
Please log in to see this code.
However, Streak's code:
CODE:
Please log in to see this code.
generates a compile error, that you cannot cast a double to int,
Eb
Size:
Color:
QUOTE:
generates a compile error, that you cannot cast a double to int,
Not at all. No compile error in 6.5. (Actually, even a possible difference in installed .NET framework versions couldn't explain that.) streak's statement is perfectly valid from syntax standpoint.
Size:
Color:
Sorry, you are right. I had not tested that approach in 6.5 yet. Only upgraded from 6.4? yesterday.
Size:
Color:
Streak, your suggestion works after all.
I have no idea what caused the compile error. Though sometimes I get gremlins in the editor, that disappear, if I close and reload the strategy.
Thank you.
As to why a bar number is returned as a double, I will refrain from compllaining about it, to avoid distraction from my many other complaints.
Size:
Color:
Probably just that, I think, all dataseries objects are of type double (could be very awkward if there was a mix).
Size:
Color: