# Amount of Decimals Changing in the Background?  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
Jobauma
Posts: 102
Joined: 16 Apr 2013
Has thanked: 22 times
Been thanked: 4 times

### Amount of Decimals Changing in the Background?

Hi.

I've achieved to automatically make ticks to pips ( or what a tick is ), but there seems to be something wrong. It doesn't work all the time.

The concept is to count the decimals to decide what 1 tick (pip) is. I've made an average of the counting of decimals ( of the value of "close" ). This makes it work almost all the time, but not always ( to make it more stable ).

The code is like this:

Code: Select all

``` // Ticks to Pips: // Count Decimals: m_Price_TicksToPips_CountDecimals.Value = BitConverter.GetBytes(decimal.GetBits((decimal)(Bars.Close))); // Count Decimals Average ( on Last Bar ): if (Bars.LastBarOnChart) m_Price_TicksToPips_CountDecimals_Average = Math.Round(Average( m_Price_TicksToPips_CountDecimals, 34 )); // Set Tick: if ( m_Price_TicksToPips_CountDecimals_Average == 5 || m_Price_TicksToPips_CountDecimals_Average == 4 ) m_Price_TicksToPips_SetTick = 0.00001; else if ( m_Price_PointsToPips_CountDecimals_Average == 3 ) m_Price_TicksToPips_SetTick = 0.001; ```
Is it true that the amount of decimals change in the background? Or am I missing something? The code should work all the time, but doesn't.

Any help is appreciated. Best regards,

Henry MultiСharts
Posts: 9089
Joined: 25 Aug 2011
Has thanked: 1258 times
Been thanked: 2923 times

### Re: Amount of Decimals Changing in the Background?  [SOLVED]

Hello Johannes,

You can calculate the tick size using Bars.Info.MinMove and Bars.Info.PriceScale.
1 tick = MinMove * PriceScale.
Keep in mind that the symbol should be properly configured in Quote Manager.

Jobauma
Posts: 102
Joined: 16 Apr 2013
Has thanked: 22 times
Been thanked: 4 times

### Re: Amount of Decimals Changing in the Background?

Thank you very much!