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

 

Evening. Folks, can anyone help with the previous request?

If it's not too much trouble for anyone. The code is small, you can remove a part of the code from the inductor. Not to mark (draw) the price itself... Thank you =)

Files:
 
beginner:

Trying to get the values of the current candle as in the textbook

I get every tick

on the current candle values at the open price

how to get the real values

Close[0]!=rates[0].close????

void OnStart()
  {
//---
   MqlRates rates[];
   ArraySetAsSeries(rates,true);
   int copied=CopyRates(Symbol(),0,0,100,rates);
   if(copied>0)
     {
      Print("Скопировано баров: "+copied);
      string format="open = %G, high = %G, low = %G, close = %G, volume = %d";
      string out;
      int size=fmin(copied,10);
      for(int i=0;i<size;i++)
        {
         out=i+":"+TimeToString(rates[i].time);
         out=out+" "+StringFormat(format,
                                  rates[i].open,
                                  rates[i].high,
                                  rates[i].low,
                                  rates[i].close,
                                  rates[i].tick_volume);
         Print(out);
        }
     }
   else Print("Не удалось получить исторические данные по символу ",Symbol());
  }


Can you tell me what the problem is?

I get every tick

on thecurrent candlestick to get the values at the open price

2014.02.08 14:28:19.051 2014.01.02 09:41  Proverka EURUSD,H1: 0:2014.01.02 09:00 open = 1.3751, high = 1.3751, low = 1.3751, close = 1.3751, volume = 1
 
Is it in the tester? Which mode? All ticks or by opening price?
 
Roger:
Is it in the tester? Which mode? All ticks or by opening price?

In the tester, all ticks
 

I can only assume that CopyRates() only copies the opening of the zero bar.

 
Roger:

I can only assume that CopyRates() only copies the opening of the zero bar.


In fact it does, but then how can it be used?
 
beginner:

in fact it is, but then how can it be used?
Why not directly, Close[0]?
 

On a 5, by the way, it's fine.

2014.02.09 23:28:33.000 2013.01.02 12:21:59   0:2013.01.02 12:21 open = 1.3253, high = 1.3255, low = 1.3252, close = 1.3255, volume = 11

 
Roger:
Why not directly, Close[0]?


you can, the question is why can't rates[0].close ?
 
beginner:

can, the question is why can't rates[0].close ?

I can only guess: because the object is not yet formed.
Reason: