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

 
Vinin:


I'm reading it all right:

c % 2 =(remainder of integerdivided by 2)

double (remainder of integer divided by 2) == 0 is true, or false, or ... ?:)

I can't even imagine the answer to the question about the oddness or evenness of a non integer :)

 

Dear programmers!

There is a good (in my opinion) Smi indicator. But it shows its state only once at the moment of joining the chart.

From here on it remains silent. No reaction to ticks or bars. After the restart it shows the missing parts on the chart.

Please, do something with it, so that it works properly and can be called from the iCustom().

Files:
smi.mq4  4 kb
 
Dear Community. How can I set the function in MQL4 to control the number of open orders in a given period? Let's say my EA is trading on H4. I need an order to be opened only once in the current H4 period. The next order can be opened only at next H4. Thank you
 
Slava2007:
Dear Community. How can I set in MQL4 a function that will monitor the number of orders opened within a certain period of time? Let us assume my Expert Advisor is trading on H4. I need an order to be opened only once in the current H4 period. The next order can be opened only at next H4. Thank you


Use a flag:

bool NoOpenPosition;

...

When a new position is opened:

if( CannotOpenPosition ) do not open a position;

else {CannotOpenPosition=true; and open position}

...

When a new bar is opened on H4:

CannotOpenPosition=false

 
tara:


Use flag:

bool CannotOpenPosition;

...

Thank you very much. Can you find an example?
 
Slava2007:
Thank you very much. Do you have an example?

You're welcome. An example of what? Simply, stick in the three lines above.
 
tara:

You're welcome. An example of what you need? Simply, stick in start the three lines above.

This is exactly how it is written in MQL4

"When opening a new bar on H4: ... "

 
tara:


I'm reading it fine:

c % 2 = (remainder of integer divided by 2)

double (remainder of integer divided by 2) == 0 is true, or false, or ... ?:)

I can't even imagine the answer to the question: about even or odd non-integer :)


and rightly so, it's scary to be unlearned - because there's nothing to imagine - even and odd numbers are integers by definition

 
abolk:

and rightly so, it's scary to be unlearned - because there's nothing to imagine - even and odd numbers are integers by definition

Is that for me, or for Vinin? :)
 
tara:

Are you talking to me or to Vinin? :)


of course to you

Vinin wrote to you straight away:

Vinin:


I think I wrote beforehand that it's only for whole ones. Or don't you read it well?