From theory to practice - page 105

 
Alexander_K2:
Very similar.
datetime cur_time=0;//сюда пишем время
int time_returns=1;// сюда пишем через сколько следующий тик
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   EventSetTimer(1);
   srand((uint)TimeCurrent());
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick(){ }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
   if(CheckTimerTick())
     {
      //---
      MqlTick tick={0};
      SymbolInfoTick(_Symbol,tick);// получили данные тика в сруктуру
      Print(TimeCurrent()," : ",tick.ask,"|",tick.bid);// сбрасываем данные в историю
      //---
     }   
  }
//+------------------------------------------------------------------+
bool CheckTimerTick()
  {   
   if(TimeCurrent()-cur_time>=time_returns)
     {
      time_returns=(int)round(-1*log((rand()+1.)/32768.)+1);
      cur_time=TimeCurrent();
      return(1);
     }
   else return(0);
  }
Files:
 
Nikolay Demko:
Here, Nikolai - keep this. You'll need it to write your own robot when you look at my actual results. I'm already bogged down in VisSim forever...
 
Nikolay Demko:

The tick structure can be declared as an array, not a variable, and get data for all instruments at once, but in SymbolInfoTick, instead of the _Symbol variable, which returns the current instrument name, you should overwrite the names of the instruments you are requesting.

 
Nikolay Demko:

You can declare tick structure as an array, not a variable, and get data for all instruments at once. Only in SymbolInfoTick you should overwrite names of requested instruments instead of _Symbol variable, which returns name of the current instrument.

I think you're one of MQL creators in general :)))) Is it possible to write programs so fast? However!
 
Alexander_K2:
I think you are one of the creators of MQL ^)))) Is it possible to crumple programs so quickly? How about that?

I've been sitting here for a long time ))) I've been taking part in the MT5 beta-testing.

The guys that you read the old threads were involved in testing the MT4 beta.

In fact I was writing for MT2

 
Alexander_K2:
Alexander, answer me one more question (and I'll get off your back), why take tics at random intervals if they come at random intervals anyway?
 
Nikolay Demko:
Alexander, answer me one more question (and I'll leave you alone), why take tics at random intervals when they come at random intervals anyway?

that's right! that's my point too.
you put your random intervals on top of the market random intervals.

 

I think it's time for me to leave this forum... The real pros are coming... Eh, it's a pityVladimir's not here. Probably chased after a coin tossed( and he knows where to toss it so a man becomes a hungry man), and that's it, not seen or heard from...

 
Nikolay Demko:
Alexander, answer me one more question (and I'll leave you alone), why take tics at random intervals when they already come at random intervals?
Why are they suddenly random? Have you looked at the histogram of the time intervals between ticks?
 
Alexander_K2:
Why are they suddenly random? Have you looked at the histogram of time intervals between ticks?

I'm not talking about the distribution, I'm talking about the process itself, it's random, there's definitely no pattern there.

There is in the increments, but not in the time intervals (if you don't take into account sessionalism).

Reason: