[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 148

 
Roger:
Don't worry, it returns as many as needed, you just have to want to see it.

indeed)))

Print("ma red = ",MA_M_0); // 4 signs (1.4533)

Print("ma red = ",DoubleToStr(MA_M_0,5)); // 5 digits (1.45332)

I apologize, perhaps this was a silly question)

But why so?

 
A long time ago, when MT4 did not yet exist and automated trading was in its infancy, the standard for prices was 4 decimal places. That's why they didn't bother with it.
 
figured it out... So that's the problem with "Print", I thought it was a variable)))
 
DhP:
Another easy way to avoid these troubles:
What is originally in the prevtime?
 

Suppose there isan open Buy-StopOrder which is quite far away from the current price. We need to change its open price slightly.

- Is there some minimum distance for a new open point of the same order, relative to the current value of OrderOpenPrice() below which a new open price cannot be set?

Thank you!

 
chief2000:

Suppose there is an open Buy-Stop Order which is quite far away from the current price. We need to change its open price slightly.

- Is there some minimum distance for a new open point of the same order, relative to the current value of OrderOpenPrice() below which a new open price cannot be set?

Thank you!

StopLevel - at this distance and closer to the price, the order cannot be set.

FreezeLevel - if an order is already in place and the price is at this distance or closer to it, you cannot delete or modify the order (if your brokerage company uses it)

 
artmedia70:

StopLevel - at this distance and closer to the price, you cannot place an order.

FreezeLevel - if an order has already been placed and the price has moved to it at this distance or closer, we cannot delete or modify it (if your brokerage company uses it).

That's not exactly what I was asking about. What I meant was that I have a Buy-STOP order and I want to shift its OrderOpenPrice() by the minimum possible distance (and that price is quite far from Ask).

- For example, can I move OrderOpenPrice() by 1 pip? I.e.

Новый_OrderOpenPrice = OrderOpenPrice() + Point

I'm asking, because I saw some strange errors, but I increased the distance and the errors disappeared.

(I could write a separate code and check it, but I have not been interested in it yet)

 

When comparing two variables of type double, sometimes an incorrect result is obtained. This is probably because one of the variables may be slightly larger or smaller than the other (e.g. by 10 digits). Using the NormalizeDouble function does not help in most cases. Some people advise to subtract one variable from another, but in such a case, how to most correctly construct an expression if(a>=b), subtracting one variable from another? Or maybe there is some other way?

 
Elenn:

When comparing two variables of type double, sometimes an incorrect result is obtained. This is probably because one of the variables may be slightly larger or smaller than the other (e.g. by 10 digits). Using the NormalizeDouble function does not help in most cases. Some people advise to subtract one variable from another, but in such a case, how to most correctly construct an expression if(a>=b), subtracting one variable from another? Or maybe there is some other way?

Do you really need such a high precision? - To a tenth of a digit.

If you want to compare using subtraction, you can compare with 0:

if((a-b)>0) { // ===>>> a>b

Or you can multiply by 1 000 000 and then compare :)

 
chief2000:

Do you really need that much precision? - To the tenth digit.

If you want to compare using subtraction, you can compare with 0:

if((a-b)>0) { // ===>>> a>b

Or you can multiply by 1,000,000 and then compare :)

I always use a certain +/-epsilon=Point*0.01 when comparing prices.

Multiplying by 1,000,000 will do nothing. believe me.

Reason: