This article is a technical document for those interested in fully understanding how the ROE Bars operate. It might read more like the specifications than the user guide, so you may find it challenging. Achieving what we did with these bars was quite difficult; explaining how they operate is likewise quite difficult. The fact is, bar types in NinjaTrader are limited to a total of three properties to define parameters. Don’t ask me why – that’s just how it is. The problem I faced was that I wanted to define six parameters – a minimum and a maximum range, ticks, and seconds – but had only three properties in which to do it. For indicators, of course, we could use as many properties as we wanted and could easily define whatever we wanted. But with a bar type, I had to define an input’s minimum and maximum value in a single property. We did this by defining a different *function* for different *digits* in different *place values* within the user-defined *positive integers* of the input properties.

Allow me to define some words and phrases in this next section before moving on to some examples further down. Much will be repeated throughout to hopefuly help you understand it.

**Digit**: a single *place value* integer (zero thru nine): 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

**Place value**: the number 10 has two place values: 1 is the first place value; 0 is the second or ‘last’ place value, as I call it herein. The number 256 has three place values: 2 is the first, 5 is the second, and 6 is the last.

**Positive Integers**: any whole number greater than 0 (i.e., 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, etc.).

The ROE Bars are built from a combination of parameters using up to three different inputs – **Range**, **Ticks**, and **Seconds**. Each of the three input parameters sets two different values for the input: the **Minimum Value** and the **Maximum Value. **The Maximum Value is set by multiplying the last digit, which is called the Maximum Multiplier, by the preceding place values, which set the Minimum Value. Each input parameter can return one of four possible states. The **first state** would define both a minimum and a maximum input value. The **second state **would define only a maximum input value. The **third state** would define only a minimum input value. The **fourth state** would completely disable the input. The three input parameters determine a ROE Bars chart’s period.

** Inputs**:

- Range
- Ticks
- Seconds

** States**:

- Minimum & Maximum
- Maximum only
- Minimum only
- Disabled

#### Input Parameters Defined

Each of the three inputs takes a user-definable integer of 1 or greater.

When any input parameter is set equal to 1, that input is completely disabled. For example, when the Range parameter is set to a value of 1, the Range input is not used to determine how each bar closes. At least one input must be enabled for the bars to draw properly.

The properties’ names and descriptions are the following:

**Range parameters**= the minimum and maximum range value per bar in tick-value, where range = [(High – Low) / tick-value] + 1 Tick], and where tick-value =*the minimum price-value increment of the instrument***Tick parameters**= the minimum and maximum number of ticks per bar, where ticks = the number of transactions or trades**Second parameters**= the minimum and maximum number of seconds passed within a bar

The combination of input parameters determines the ‘Period’ of a ROE Bars chart.

The number of place values and the digit set in each place value determines whether both/either a minimum and/or a maximum value is set for that input, or the input is completely disabled. To completely disable an input, set it equal to 1. Any value greater than 1 enables the input.

When a parameter has two or more place values, the last place value digit sets the Maximum Multiplier, and the preceding digit(s) set the Minimum Value.

The Maximum Value is determined by multiplying the Minimum Value by the Maximum Multiplier.

The Maximum Multiplier can have a value of between 0 and 9. When an input parameter has two or more place values and the Maximum Multiplier is set to 0, the Maximum Value is completely disabled and only a Minimum Value will be set for that input. When the Maximum Multiplier value is set to 1, the Minimum Value is completely disabled and the preceding digits set only a Maximum Value for the input. Once any Maximum Value is met, a new bar opens.

Either of the following two cases will close one ROE Bar and open the next:

- When
__all__ - When
__any__maximum value of an enabled input is met

Because each of the three inputs can take four different states, the ROE Bars would seemingly have 64 possible combinations of settings (four to the power of three) producing 64 unique charts. However, at least one input must be enabled for the bars to function, so the option where all three inputs would be disabled is therefore impossible, leaving only 63 possible combinations of settings (64 -1 = 63 options). However, when only one input is enabled, it can take only one state – the minimum state – and so a new bar would open the moment the minimum value is met. So, when only one input is enabled, the ROE Bars would take on the characteristics of the enabled input’s bar type. In other words, if the one enabled input is Ticks, then the bar would function the same way a standard Tick chart does. If the one enabled input is Seconds, then the bar would function as does a Seconds Chart.

Since only the minimum state is operating when just one input is enabled, the other two states – the minimum and maximum state and the maximum state – are no longer options. And since there are three inputs, three input times two states equals six combinations are removed from the 63 total possible combinations, leaving us with a total of 57 possible combinations for the ROE Bars.

#### Setting only minimum values

To define only a minimum value for an input, the last place value must be set to 0. For example, to set only a minimum range of 25 ticks, the Range parameters must be set to 250. To set only a minimum tick of 1,999 ticks, the Tick parameters must be set to 19990. To set only a minimum second of 333 seconds, the Second parameters must be set to 3330. The 0 in the last place value sets the maximum multiplier to 0 and therefore disables the maximum value.

***Note**: If only a single digit (one place value) of between 2 and 9 is set for an input parameter, then that value sets only the minimum value without any maximum value. Setting an input parameter to 2 has the same outcome as setting it to 20; setting it to 3 has the same outcome as setting it to 30; etc., all the way to a value of 9.

#### Setting only maximum values

To define only a maximum value for an input, the last place value must be set to 1. For example, to set only a maximum range of 50 ticks, the Range parameters must be set to 501. To set only a maximum tick of 10,000 ticks, the Tick parameters must be set to 100001. To set only a maximum number of seconds of 1,200 seconds, the Second parameters must be set to 12001. The 1 in the last place value disables the minimum value.

#### Setting both maximum and minimum values

To define both a minimum and a maximum value, the last place value is used as the ‘maximum multiplier’ which sets the maximum value equal to a multiple of the minimum value. Like this, however, we are limited to a total of eight possible ‘maximum multipliers’ by which to set the maximum value: 2 through 9.

For example, to set a minimum range value of 2 ticks and a maximum range value of 8x the minimum, the Range parameters must be set to **28**.

- The last place value of 8 sets the maximum multiplier
- The preceding place value(s) (in this case, just the one) of 2 sets the minimum value
- 2 minimum X 8 maximum multiplier = 16 maximum value

To set a minimum tick value of 1,000 ticks and a maximum tick value of 5x the minimum, the Tick parameters must be set to **10005**.

- The last place value of 5 sets the maximum multiplier
- The preceding place values of 1000 set the minimum value
- 1000 minimum X 5 maximum multiplier = 5000 maximum value

To set a minimum seconds value of 337 seconds and a maximum seconds value of 9x the minimum, the Second parameters must be set to 3379.

- The last place value of 9 sets the maximum multiplier
- The preceding place values of 337 set the minimum value
- 337 minimum X 9 maximum multiplier = 3033 maximum value

#### Example Settings of 621, 31754, 754

**Range parameters** = 621

- The last place value of 1 disables the minimum value and sets the preceding place values to the maximum value
- The preceding place values of 62 sets the maximum range value

**Tick parameters** = 31754

- The last place value of 4 sets the maximum multiplier
- The preceding place values of 3175 set the minimum ticks value
- 3175 minimum X 4 maximum multiplier = 12700 maximum ticks value

**Second parameters** = 754

- The last place value of 4 sets the maximum multiplier
- The preceding place values of 75 set the minimum seconds value
- 3175 minimum X 4 maximum multiplier = 300 maximum seconds value

One bar will close and the next bar will open for either of the following two cases:

- All minimums are met: (minimum range is disabled) 3175 ticks or 75 seconds
- Any maximum is met: 62-tick range, 12700 ticks, or 300 seconds

#### Example Settings of 90, 71634, 1244

**Range parameters** = 90

- The last place value of 0 disables the maximum value
- The preceding place value of 9 sets the minimum range value

**Tick parameters** = 71634

- The last place value of 4 sets the maximum multiplier
- The preceding place values of 7163 set the minimum ticks value
- 3175 minimum X 4 maximum multiplier = 28652 maximum ticks value

**Second parameters** = 1244

- The last place value of 4 sets the maximum multiplier
- The preceding place values of 124 set the minimum seconds value
- 124 minimum X 4 maximum multiplier = 496 maximum seconds value

One bar will close and the next bar will open for either of the following two cases:

- All minimums are met: 9-tick range, 3175 ticks or 75 seconds
- Any maximum is met: (maximum range is disabled), 28652 ticks, or 496 seconds