Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Can I use a DataSeries as part of an 'if' statement?
I tried to use a DataSeries called "cond1"
similar to the way Scott did in his TimeToTrade code with ' _signal', but couldn't get it to work.
I declared it in Variables with
private DataSeries cond1;
I initialized it as cond1 = new DataSeries(this);
I set it with cond1.Set(+1);
I put it in Properties with
public DataSeries Cond1 (not sure which one I should use.)
{
// get { return cond1; } //c I tried both of these.
get { return Values[4]; } //d
but when I tried to use it with (not sure about this either)
// if (cond1[0] = 1) //a I tried both of these.
if (cond1 = 1) //b
I got these errors from the above combinations:
a & c = Cannot implicitly convert type double to bool
a & d = Cannot implicitly convert type double to bool
b & d = Cannot implicitly convert type 'int' to DataSeries
b & c = Cannot implicitly convert type 'int' to DataSeries
I've been programming TS for years and am 2wks into C# trying
to go thru as many webinars etc as possible.
But something is not sinking in.
Hoping someone can point me in the right direction.
Don
Can you help answer these questions from other members on NexusFi?
Thanks for your previous advice.
I did get thru another 60 pages in the C# reference manual and that helped also.
In the ZigZagUTC i see numbers with 15 decimal places. Is there a place to select how many decimals?
I also looked at the Sample FontChange reference in ninja. Was wondering if there is a demo that shows how to allow choice of font SIZE(pxl) in the Indicator Panel?
Would like to be able to make a similar choice for DrawDot size . Any references or examples of that?
This maybe talking about something else entirely but i've seen this before in my own coding (i'm a beginner here)
If statements compare two or more data types that must be the same. It must evaluate to either true or false (a bool)
if(EMA(8))
{ //would produces a type conversion error because it's looking to evaluate to bool but this is a series}
if(EMA(8)[0]))
{//would produce a type conversion error because this statement does not produce true or false evaluation only an int}
if(EMA(8)[0] == EMA(8)[0])
{//this would produce either a true or false evaluation and would not produce any errors because the conditions of the
// if statement have been satisfied}
In your code find out exactly what cond1 is. if it is s series you need to choose one data point in the series and compare it to another piece of data of the same type in order to have a valid if statement.
I could be wrong here but I went through the same issues when i was figuring out conditional statements like if. Can someone else verify that I'm correct?
"I've missed more than 9,000 shots in my career. I've lost almost 300 games. 26 times, I've been trusted to take the game-winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed."
- Michael Jordan, 5-Time NBA Most Valuable Player, 6-Time NBA Champion
but that won't work if cond1 is a series. You'd get an error I think
"I've missed more than 9,000 shots in my career. I've lost almost 300 games. 26 times, I've been trusted to take the game-winning shot and missed. I've failed over and over and over again in my life. And that is why I succeed."
- Michael Jordan, 5-Time NBA Most Valuable Player, 6-Time NBA Champion