[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 603

 
sergeev:

how do you understand #include?

as in the Doka or in your own way?


as in the Doka.

there is a file.

There is a reference to it in the EA.

This is enough to ALREADY use in any place of the EA, for example, in the following way

if isCloseLastPosByTake()<0... ?

 
rigonich:

The question is not that it worked, but that if the reference is written correctly, it shouldn't work.


the certificate says some bullshit about the number of seconds elapsed since 1 January 1970 :))))))

I don't know what to think...

 
hoz:

I need the owl to put a pending order exactly on the opening of a candle on D1.

I have written a function:

The compiler frowns:

Everyone has brackets. This is strange. If this function is commented out, the code compiles without errors. What may be wrong?

Am I correct in writing the function to open only at opening price of a daily candle?


Well, clearly a parenthesis is missing :))))

it should beif(TimeCurrent() == iTime(Symbol(),1440,0)

it shouldif(TimeCurrent() == iTime(Symbol(),1440,0))

 

sergeev:
И вообще я верно написал ф-цию для того чтобы открываться только по цене открытия дневной свечи

No.


What's the right way then? I'm comparing the current time to the time we need... What's wrong?

//+-------------------------------------------------------------------------------------+
//| Получение времени установки отложенного ордера                                      |
//+-------------------------------------------------------------------------------------+
bool GetTimeToInput()
{
  if(TimeCurrent() == iTime(Symbol(),1440,0))
  {
    return(true);
  }
  else
    
  return(false);
}
 
lottamer:


the fact sheet says some bullshit about the number of seconds elapsed since 1 January 1970 :))))))

I don't know what to think...

some bullshit about the number of seconds since 1 January 1970 : That's how a computer remembers dates. It has no other way...
 
rigonich:
some bullshit about the number of seconds since 1 January 1970 : This is how a computer remembers dates. It has no other way of doing it...


:))) and what have we got to do with it? A computer can remember dates the way it likes - let it give them to us in a human way:))
 
lottamer:


What next? This is enough to ALWAYS use any part of the EA, e.g.

if isCloseLastPosByTake()<0... ?

Think about it, if you've made from one file to another Copy Paste.

 
hoz:


 А как тогда правильно? Я же сравнил Текущее время,  с тем, которое нам нужно.. Что не так?

 

 

And did I write the function to open only at the opening priceof the day's candle?
And where is the price in your function?
 
hoz:


What's the right thing to do then? I'm comparing the current time to the time we need... What's wrong?

wrong is that this time for the == sign only exists for 1 second.

It's correct to either put a 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 the positive outcome of a logical operation of an order opening condition.

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


You need to tie the successful operation to the time too.

think.

 

rigonich:

А где у вас в функции цена?  



So for the price, it is a different function. This function is only for time.
Reason: