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

 
avatara:

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

Multiplying by 1,000,000 won't do anything. believe me.

I don't quite understand why there should be a problem <- bug?

In the documentation:

digits   -   Precision format, number of digits after decimal point (0-8). 

i.e. there's a maximum of 8 decimal places, and the question mentioned 10 - maybe that's the issue?

 
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?

I remembered a problem I observed myself a long time ago (maybe something has changed since then, I don't know):

a=5 and c=4.0.

From the MQ point of view it is not necessarily true that a>c in this particular case.

It would be true if a=5.0 and c=4.0, or a=5 and c=4.

 

Good afternoon!

Suppose we have two numbers 1.4451 and 1.4429.

How to take the last digit of 1.445[1] and 1.442[9] from these numbers ?

 
TEXX:

Good afternoon!

Suppose we have two numbers 1.4451 and 1.4429.

How to take the last digit of 1.445[1] and 1.442[9] from these numbers ?

x = (10000 * y) % 10
 
Zhunko:
x = (10000 * y) % 10


and can it be written with numbers for the idiots...

Thanks in advance!!!

 

Good day! May I repeat myself? I am using MACDAC as a trend filter in my EA, is it possible to make my EA start analysing the signals only from a certain bar on a macdak and then when the trend changes, everything changes again? For example MAKDAK>0 beginning of a trend, begin to analyse the signals only after the 15th bar of a Makdak which is greater than zero?

THANK YOU!

 
TEXX:


Can it be written with numbers, so that for idiots...

Thanks in advance!!!


1.MQL4 Reference (MetaEditor)-->Language Basics-->Operations and Expressions-->Arithmetic Operations
2.Tutorial -->https://book.mql4.com/ru/basics/expressions
x = (10000 * 1.4451) % 10, where "%" is the arithmetic operation "remainder of division" (in our case by "10"), " * "is the arithmetic operation "multiplication of values".
 
SeALALex:

Hello, may I repeat myself? I am using MACDAC as a trend filter in my EA, is it possible to make my EA start analyzing the signals only from a certain bar on the macdak and, if the trend changes, start analyzing the signals again? For example, MACD>0 start a trend, start to analyse the signals only after the 15th bar of the macdak which is higher than zero?

THANK YOU!

What is the problem? Remember the Bar (time) when the MACD crosses 0, and for each new Bar compare how far away it is from it. If Delta>15 => go ahead.

 

Please advise what is wrong!



avatar
1
smith 06.09.2011 13:08
I have made a tipster, by my strategy I should place one order per hour when I open a bar at price relative to the open bar price (h1). When tested on the resulting bar all is OK, but when tested on all timeframes (however, as in the real trade) all the time with each price change puts an order one after the other! (How can I control it!? I have tried it on mt4 and mt4 terminal too. Please suggest a function for this kind of problem, preferably with an example.
 
sergeev:

Please advise what is wrong!



1
smith 06.09.2011 13:08
I have made a tipster, by strategy I should place one order per hour at open bar price (h1) relative to open bar price. When tested on the resulting bar all is OK, but when tested on all timeframes (however, as in the real trade) all the time with each price change puts an order one after the other! (How can I control it!? I have tried it on mt4 and mt4 terminal too. Please suggest a function for this kind of problem, preferably with an example.

.. When testing using the "All Ticks" method.

Global variable is set at the beginning (before start() ):

datetime TimeHandle = 0;

start() {
   i = 0;                        // Для Советников
   if(TimeHandle!=Time[i]) {
      TimeHandle = Time[i];

   . . . 

   }
}
Reason: