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:
Is it true that the amount of decimals change in the background? Or am I missing something?
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 ):
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;
The code should work all the time, but doesn't.
Any help is appreciated.
Johannes Hillestad Baumann