Please explain what could be wrong with this function? - page 5

 
Karputov Vladimir:
You'd better tell us what the service department advised you - you continued to talk to them, didn't you?
For some reason I don't knock on a closed door more than three times. Not one response to my three comments... And why shout into the void?
 
Alexey Viktorov:
I don't knock on a closed door more than three times for some reason. Not a single response to my three comments... And why shout into the void?

CopyRates() on each tick, running on M15 will support history cache by non-native period (timeframe) (H1 and D1).

And you can also request instead of copying series via CopyRates()

SYMBOL_TIME

Last quote time

datetime

and use this time to determine whether it is a new day or a new hour... In this case, instead of copying the series, you simply poll the terminal and perform a simple time analysis. You can also use a more informativeSymbolInfoTick.

 
Karputov Vladimir:

CopyRates() in each tick, running on M15 will support history cache by non-native period (timeframe) (H1 and D1).

And also it is possible, instead of copying series via CopyRates(), to simply request

SYMBOL_TIME

Last quote time

datetime

and use this time to determine whether it is a new day or a new hour... In this case, instead of copying the series, you simply poll the terminal and perform a simple time analysis. You can also use the more informativeSymbolInfoTick.

Vladimir, the question about the jerking was not accidental. In that EA in which such problems were found, CopyRates() is called on every tick, hence the story jerking theory is tantamount to jerking the cat by its causal place... Not to be rude...

And even now, when you have understood that the problem exists, the application ignoring in SD stubbornly continues. I'm not really interested, a solution has been found and you can get used to other problems and take into account stupidity of some functions, but my desire to inform the CA about any problems is fast approaching zero.

I'm writing now from another computer, no code, but you can check it yourself... How many daily bars do you think there are between 27.06.2016 00:00:00 and 27.06.2016 00:00:00??

You think zero??? You're wrong, check it with Bars() Stupidity, but you can just take it into account if necessary, and when they do think of fixing it... Well we'll fix our own code...

 
Alexey Viktorov:

Vladimir, the question about jerking was not accidental. In that EA, in which such problems were found, CopyRates() is called on every tick, hence the theory of jerking history is tantamount to jerking the cat by the causal place... Don't think of it as rude...

And even now, when you've realised that there's a problem, the ignoring of the application in the SD stubbornly continues. I'm not really interested, the solution is found, you can get used to other problems and keep in mind the stupidity of certain functions, but the urge to report any problems to the CA is rapidly moving towards zero.

I'm writing now from another computer, no code, but you can check it yourself... How many daily bars do you think there are between 27.06.2016 00:00:00 and 27.06.2016 00:00:00???

You think zero??? wrong, check with Bars() Stupid, but you can just take it into account if necessary, and when you do get the idea to fix it... Well we'll fix our own code...

No need to make it up - you provided an EA WITHOUTCopyRates().
 
Karputov Vladimir:
No need to make things up - you provided an EA WITHOUT CopyRates().
I gave the code when there was no talk of jerking. I repeat, I'm writing from a computer where I have no code and installed MT5, so please make changes yourself, not in the function of determining a new bar, but before its call in the main code OnTick(). and repeat the experiment.
 
Alexey Viktorov:
I gave the code when there was no talk of jerking. I repeat, I'm writing from my PC where I don't have any code and MT5 has been installed, that's why I ask you to make changes yourself not in the function defining a new bar but before its call in the OnTick() main code and try the experiment again.

If there is a code, there is judgement. If there is no code, then everything goes into coffee grounds mode. If you're at the computer, make up a code with my recommendations

Forum on trading, automated trading systems and strategy tester

I have tried it and I don't know what is wrong with the function, I will try to use it as a substitute for the strategy, I will use it as an input for the profit.

Karputov Vladimir, 2016.06.27 13:36

***

Or you can use CopyRates() instead of copying series, you can just request

SYMBOL_TIME

Last quote time

datetime

and use this time to determine whether it is a new day or a new hour... In this case, instead of copying the series, you simply poll the terminal and perform a simple time analysis. You can also use a more informativeSymbolInfoTick.


and check it on your own.

 

It's more or less like this

datetime oldDay, oldHour;
MqlDateTime mqlDateTime;
MqlRates    mqlRates;
/*******************Expert initialization function*******************/
int OnInit()
{
   return(INIT_SUCCEEDED);
}/*******************************************************************/

/************************Expert tick function************************/
void OnTick()
{
  bool newDay, newHour;
   TimeToStruct(TimeCurrent(), mqlDateTime);
   CopyRates(_Symbol, PERIOD_H1, 0, 1 mqlRates);
    if((int)mqlDateTime.hour == 0)
     {
      newDay = IsNewBar(_Symbol, PERIOD_D1, oldDay);
   if(newDay)
    Print("***** newDay ", newDay, " mqlDateTime.hour ", mqlDateTime.hour); // Судя по распечатке newDay = true
       newHour = IsNewBar(_Symbol, PERIOD_H1, oldHour); // А это совсем другая переменная
    if(newHour)
     Print("***** newHour ", newHour); // Судя по распечатке newHour = true
        if(newDay && newHour) // A ЭТО УСЛОВИЕ НЕ ВЫПОЛНЕНО НЕСМОТРЯ НА ПРЕДЫДУЩИЕ РАСПЕЧАТКИ.
         {
          Print("Ордер должен откыться. ");
         }
     }
}/*******************************************************************/

/*****************Определение появления нового бара******************/
bool IsNewBar(string symbol, ENUM_TIMEFRAMES timeframe, datetime &m_tOld)
 {
  datetime tNew = (datetime)SeriesInfoInteger(symbol, timeframe, SERIES_LASTBAR_DATE);
   if(tNew > m_tOld)
    {
     m_tOld = tNew;
     return(true);
    }
   return(false);
 }
/********************************************************************/

/******************Expert deinitialization function******************/
void OnDeinit(const int reason)
{
 Comment("");
}/*******************************************************************/
 
Alexey Viktorov:

It's more or less like this

Where are the response checks from CopyRates()?
 
Karputov Vladimir:

If there is a code, there is judgement. If there is no code, then everything goes into coffee grounds mode. If you're at the computer, make up a code with my recommendations


and check it out for yourself.

Yeah, well... Presumption of innocence in action...

Do I need it? There are bugs in the MQ program. I can work around them myself or with your advice, but the errors and nonsense in MQ software will still be errors and nonsense.

I won't be at the computer until next Friday. And the cat jerking has already been tested. And it makes no difference whether you yank it with your right hand or your left... Mistakes are mistakes, stupidity is stupidity.

 
Karputov Vladimir:
Where are the response checks from CopyRates()?
I understand that your interest in confirming the error is zero. That's why you can do nothing by yourself... And I don't have to, I'm not going to prove it to you. What's in it for me? Nothing...