Code Snippets MQL4

Short texts MQL4 🧑‍💻 Code snippets MQL4 ✍️ Reading lists MQL4 👀

code.mq4

// get pip difference of opened order and the current market price int point_compat = 1; if(Digits == 3 || Digits == 5) point_compat = 10; double diff = (OrderType() == OP_BUY) ? (NormalizeDouble(((OrderOpenPrice() – Ask)/MarketInfo(Symbol(), MODE_POINT)), MarketInfo(Symbol(), MODE_DIGITS)))/point_compat : (NormalizeDouble(((OrderOpenPrice() – Bid)/MarketInfo(Symbol(), MODE_POINT)), MarketInfo(Symbol(), MODE_DIGITS)))/point_compat;