OrderOpenPrice()与OrderTakeProfit() 这2个值明明一样的,但为什么程序还认为他们不一样呢

 

if(OrderOpenPrice()!=OrderTakeProfit() ){

}

明明是一样,但却认为不一样,为什么

 
你解释一下怎么个“明明是一样“?
 

如如 2个函数返回值 都是:97.450000

不是都是一样吗,但程序为什么认为他们不一样

 

浮点数的问题。不要用不等于的比较。

if(OrderOpenPrice()>=OrderTakeProfit()+1*Point && OrderOpenPrice()<=OrderTakeProfit() -1*Point )

 

或者用

if(MathAbs(OrderOpenPrice()-OrderTakeProfit())>=1*point)

 
谢谢楼上的。
原因: