When to use BoolSeries rather than simple variable
Is there ever any reason to use a xSeries (where x is Bool, Data, etc.) other than as required for processing logic or as required by a given indicator? i.e. are there some situations in NT in which one should use these?
Boolean logic is used all the time. I've written functions to return True or False values. Example: "If FileExists then" - the value returned by the function(FileExists) is either True or False. If the statement is True do this, if the statement is False do that.
By using Gates such as AND or OR within an IF statement also processes the outcome as being True or False.
True or False is the same as 1 or 0 in memory. Checking a value like xyz = str would use more memory making it less efficient. Boolean logic uses less memory which would execute the code faster. The compilation of the code should be smaller. Some compilers will optimize the code automatically for you.
There's no right or wrong answer. Code should be as streamlined as possible. Execution of the code should be quick for indicators.
its because dataseries stores the data of ALL previous Bars in the chart
but doubles like double eco01 = (ECO2(21,45,8,6));
only stores the value of the bars you need at the moment of your calculation.
The following 2 users say Thank You to max-td for this post:
Yes... been many years for me as well... and I never did OO programming... I'll have a look... my question was more specifically w/in NT... as far as the data structure itself... BoolSeries vs. variable
wh.. not following you.. was this meant for someone else? I was asking about making a decision when writing custom code... on whether or not a variable should be set up as a simple variable or as a BoolSeries... Maybe I'm missing something.. but thought you might have meant this for some other question...
yep... that's it... someone also mentioned to me that if (for testing or future "look-back") one wants to see past data displayed in the data box, it would have to be set up as a Series. I assume that there are some methods that might require a series, but that is just conjecture... I'm just starting to dig into coding and although I've done a lot of programming in my life... not since 1985 and never OO.