NexusFi: Find Your Edge


Home Menu

 





When to use BoolSeries rather than simple variable


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Saroj with 5 posts (0 thanks)
    2. looks_two RJay with 2 posts (1 thanks)
    3. looks_3 jonesr9 with 2 posts (3 thanks)
    4. looks_4 wh with 1 posts (0 thanks)
    1. trending_up 7,427 views
    2. thumb_up 6 thanks given
    3. group 2 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 482 since Jun 2009
Thanks Given: 232
Thanks Received: 416

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?


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
Prediction Markets & Event Contracts
Irans Answer Due Today: Peace Surges to 33.5%, Invasion …
Prediction Markets & Event Contracts
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
$4.5M Floods Russia Nuclear Contract in 24 Hours -- Krem …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #2 (permalink)
 jonesr9 
FL
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, 6E, CL
Posts: 71 since Jul 2009
Thanks Given: 159
Thanks Received: 34

It's been quit a few years since I've programmed.

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.

Here's a link that helps describe Gates.
HowStuffWorks "Simple Gates"


Reply With Quote
Thanked by:
  #3 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927


hi,
here is something that direction a asked a while ago - maybe useful to know :

pivate DataSeries vs. double - NinjaTrader Support Forum

its because dataseries stores the data of ALL previous Bars in the chart
but doubles like double eco01 = (ECO2(21,45,8,6)[1]);
only stores the value of the bars you need at the moment of your calculation.


max-td
Reply With Quote
Thanked by:
  #4 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 482 since Jun 2009
Thanks Given: 232
Thanks Received: 416

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


Started this thread Reply With Quote
  #5 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 Vendor: www.innovative-trading-solutions-online.com 
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: ES
Posts: 687 since Jun 2009
Thanks Given: 765
Thanks Received: 789

Saroj,

Bool = one of two choices

0 or 1
on or off
true or false
etc.

double = any decimal number.


Reply With Quote
  #6 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 482 since Jun 2009
Thanks Given: 232
Thanks Received: 416

thanks RJay... yes I understand what boolean is... trying to better understand when to use as a variable as opposed to a BoolSeries...


Started this thread Reply With Quote
  #7 (permalink)
 
wh's Avatar
 wh 
Neubrandenburg, Germany
 
Experience: Advanced
Platform: R
Trading: Stocks
Posts: 538 since Jun 2009
Thanks Given: 298
Thanks Received: 512

it is simple
for example you look on each bar if it is a new hh or ll

if true add to bool series
if false add to bool series

wh


Reply With Quote
  #8 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 482 since Jun 2009
Thanks Given: 232
Thanks Received: 416

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...


Started this thread Reply With Quote
  #9 (permalink)
 
RJay's Avatar
 RJay 
Hartford, CT. USA
 Vendor: www.innovative-trading-solutions-online.com 
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG, Kinetick
Trading: ES
Posts: 687 since Jun 2009
Thanks Given: 765
Thanks Received: 789

Saroj,

Is this what you wanted to know...


Use a simple variable for calculations only needed right now.

Use a series if you are going to need this data in future calculations.

RJay


Reply With Quote
Thanked by:
  #10 (permalink)
 
Saroj's Avatar
 Saroj 
Arcata, CA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: index futures, oil
Posts: 482 since Jun 2009
Thanks Given: 232
Thanks Received: 416


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.


Started this thread Reply With Quote




Last Updated on November 24, 2009


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts