[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 604

 
sergeev:

not so that this time for the == sign only exists for 1 second.

it is correct to either put the sign >=

or go through the control of two time variables - current and previous.


That's what I thought. Thank you. I'll be experimenting.
 
lottamer:

:))) and what do we have to do with it? A computer can memorise as it likes - but let us have it output in a human way:))

It gives out what it is asked for, and it cannot "humanly" by definition, it's a computer, not a human being.
 

read here https://forum.mql4.com/ru/38949/page2#434212


The ExistPosByPrice() function.

This function returns a flag for the existence of a position at a given open price.

What isan Exist flag?

 
hoz:

So ask if you wrote the function you are showing correctly, otherwise you are asking about one thing and showing another.
 
lottamer:

read here https://forum.mql4.com/ru/38949/page2#434212


The ExistPosByPrice() function.

This function returns a flag for the existence of a position at a given open price.

What is"Exist flag"?


A flag is a variable, usually of the bool type, which is set to a state depending on the truth of the condition being checked (here - there is a position with a given opening price).
 
sergeev:

not so that this time for the == sign only exists for 1 second.

it is correct to either put the sign >=

or go through the control of two time variables - current and previous.

But on the other hand you have a logical error. You are trying to bind a second to a positive outcome of a logical operation of an order opening condition.

This is not correct. The order may fail to open, which means you will not try to open it on the next tick - since the time function will return false


I got the general idea. Here's what came out:

bool GetTimeToInput()

{

  if(TimeCurrent() >= iTime(Symbol(),1440,0) && TimeCurrent() <= iTime(Symbol(),1440,0) + N)

  {

    return(true);

  }

  else

    

  return(false);

} 

N is the number of minutes after the opening of the daily bar. So far, I have not figured out how to get it, so I have written a pure variable. It seems to be correct.

sergeev:

You have to bind the memorizing of successful operation to the time.

think.

But I'd like to clarify what you mean by "binding saving of successful operation to time". I did not quite understand.

 
hoz:


I got the general idea. Here's what came out:

N is the number of minutes elapsed since the opening of the daily bar. So far I did not understand how to get it, so I wrote purely a variable. It seems to be correct.

Sergeev:

But I want to explain more clearly, how to connect memorizing of successful operation with time. I don't quite understand.


It's not time itself that's important to you, but whether something was done within a certain period of time - this is what you should check.

P.S. And you don't need to determine N, just do your checkif(TimeCurrent() >= iTime(Symbol(),1440,0) ) until the actions you need are done (installing an order).

 
rigonich:

A flag is a variable, usually of bool type, which is set to a state depending on whether the condition is true or not (here - if there is a position with a given open price).

I see, what is the position INDEX? it's not a ticker, and it's not a type....
 
lottamer:

got it, what is an order index ? it's not a ticker, and it's not type....


This is the index that determines the position of the order in the array where the data on the orders present in the terminal is stored.

In other words, itis underlined (under SELECT_BY_POS) boolOrderSelect(int index, int select, int pool=MODE_TRADES)

 
rigonich:


This is the index that defines the order position in the array where the data on orders present in the terminal is stored.

That is,what is underlined( with SELECT_BY_POS) bool OrderSelect(int index, int select, int pool=MODE_TRADES)



but how do you apply this in practice if you need to code a condition "if the last two trades were loses....."? ??