Double to int - page 2

 
FMIC:

Then use "round()", or "floor()" or "ceil()" depending on what you need.

Neither "round()", nor "floor()" nor "ceil()" and nor NormalizeDouble() give me the integer part, I just used the int casting, and it is fine.
FMIC:
For an Open order, "OrderClosePrice()" is the current price. "Buy" orders open at Ask and close at Bid. "Sell" orders open at Bid and close at Ask. Since your code does not test which type it is, you must use "OrderClosePrice()".

thanks. I didn't know that, but I need a fixed price, so I can compare with. Bid is good.
FMIC:

Overall you are missing the main point. It is not a question of fixing "bugs", but that in general you don't really understand the main concepts and constructs that you are using.

So, until you do. First practice by coding small pieces of "C" code that is independent of it working in Meta-trader and as a EA. Use online resources that go though all the steps from beginner to a higher level of coding in "C".


It's not like what you think, but I will do that.

===============

Why (Bid - OrderOpenPrice()) result is multiple of Point ?  1.43520-1.43500=0.00020 ????

 
m_shafiei2006:
Neither "round()", nor "floor()" nor "ceil()" and nor NormalizeDouble() give me the integer part, I just used the int casting, and it is fine.
thanks. I didn't know that, but I need a fixed price, so I can compare with. Bid is good.

It's not like what you think, but I will do that.

===============

Why (Bid - OrderOpenPrice()) result is multiple of Point ?  1.43520-1.43500=0.00020 ????

The minimal movements of the prices are 1 Point. So any difference has to be a "multiple of 1 Point".
That means (1.43520-1.43500)/_Point is always an integer-value.
Remark: The size of 1 Point might differ from Broker to Broker!!
And - just to confuse you ;) - at a 4-digit Broker (or account) a pip = point  and at a 5-digit broker (or account) a pip = 10.0*point.
 

There is Tick, PIP, and Point. They are all different in general. A tick is the smallest change of price. A Point is the least significant digit quoted. In currencies a pip is defined as 0.0001 (or for JPY 0.01)

On a 4 digit broker a point (0.0001) = pip (0.0001). [JPY 0.01 == 0.01] On a 5 digit broker a point (0.00001) = 1/10 pip (0.00010/10). Just because you quote an extra digit doesn't change the value of a pip. (0.0001 == 0.00010) EA's must adjust pips to points (for mq4.) In currencies a tick is a point. Price can change by least significant digit (1.23456 -> 1.23457)

In metals a Tick is still the smallest change but is larger than a point. If price can change from 123.25 to 123.50, you have a TickSize of 0.25 and a point of 0.01. Pip has no meaning.

This is why you don't use TickValue by itself. Only as a ratio with TickSize. See DeltaValuePerLot()

 

Thank you all.

these are very useful information.

Reason: