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) }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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
Additional question
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