Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 928

 
abeiks:
Hello!
How can I get every tick from other currency pairs in Expert Advisor (MQL4)?
Then can you tell me how to get every 10ms information about ticks from other currency pairs?
 
OnTimer() will help you.
 
AlexeyVik:
OnTimer() is your help.
Thank you!
 
AlexeyVik:
OnTimer() will help you.
The specified periodicity of EventSetTimer( int seconds ) is used there. Does it mean that I can get information about ticks every 1 second? I need faster - 10-20ms.
 

The indicator needs to get the index by the opening time of the daily bar, on a smaller timeframe.

It works correctly only on the zero bar. What is wrong?

#property indicator_separate_window
#property indicator_buffers 1
#property  indicator_color1 Magenta
//--- input parameters
//--- buffers
double I[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(1);
   SetIndexBuffer(0,I);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int counted_bars=IndicatorCounted(),limit, i,index;
    datetime DAY;
    bool exact=true;
   if(counted_bars>0)
      counted_bars--;  
   limit=Bars-counted_bars-1;
   for(i=limit;i>=0;i--)
   {
      DAY=iTime(NULL,PERIOD_D1,i);
      index=iBarShift(NULL,PERIOD_CURRENT,DAY);
      I[i]=index;
   }
   return(0);
  }
//+------------------------------------------------------------------+
 
abeiks:
The specified periodicity of EventSetTimer( int seconds ) is used there. Does this mean that I can get tick information every 1 second? I need faster - 10-20ms.
Not only EventSetTimer( int seconds ) but also EventSetMillisecondTimer, why are you so inattentive? It's written next to it.
 
AlexeyVik:
Not only EventSetTimer( int seconds ) but also EventSetMillisecondTimer, why are you so inattentive? It is written next to it.
Thank you! I was looking in the reference book OnTimer and it mentions only EventSetTimer.
 
Can you tell me how to write a simple EA like this? It opens an order at a certain time of day, and then if the order closes at a stop loss, it opens the same order in the opposite direction. The next day everything repeats. I would like to test this kind of EA and see if its profit will be stable. Please help me to write it.
 

Please help me, how do I write"if the price came from a certain range"?

Example from the picture: to open a trade, the price should come from a certain range 1.1100 and 1.1100 should come from a certain range 1.1200.

The variant with iHighest and iLowest is not suitable because this condition is not time-dependent.

 
Is there a way to check from the code in which mode the test is running -
all ticks, open prices or test points?
Reason: