# How to know 2 price is at same price regardless of small different

How do I compare between 2 price if these 2 price is exact value?

1st price = where the value of SHIFT or BAR == 2

2nd price = where the value of SHIFT or BAR == 1

Example:

SHIFT 2 currently the candlestick is in Bullish

SHIFT 1 currently the candlestick is in Bearish

Both of candlestick for

SHIFT 2 has close price 1234.56

SHIFT 1 has open price 1234.45

Both of them actually in same price level with only different is the decimal value.

Goal

I want to keep both price as what they are without manipulated it but also able to to tell that the 2 price is actually the same.

This template will be using for multiple timeframe, so assign a small value to it may cause different in calculation. Especially on higher timeframe.

Plan

I want to create a function template that will return boolean (true | false) depending on condition

```template<typename T>
T ExactPrice(T first_price, T second price)
{
bool result = false;

//--- What do I put here?

return result;
}```

I have seen some people using average method to solve this problem. But I don't understand how average could solve the problem. If let say:

SHIFT 2 has close price 1234.56

SHIFT 1 has open price 123X.XX,, where X is random number that will result in huge different in price.

Usually people call these candlestick patter as bullish | bearish abandoned baby, kicker, doji & etc. That cause huge spike in calculation.

Thank you

Hi , try this : (in your example the digits should be 0)

```bool isSame(double price1,double price2,int digits){

int a=(int)MathFloor(price1*MathPow(10.0,digits));

int b=(int)MathFloor(price2*MathPow(10.0,digits));

return(a==b)

}```