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

 

#property strict should be added, after that the date output will be in "yyyyy.mm.dd hh:mm:ss" format even without conversion.

or TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS)

 

tu evillive

Looks like it's not that simple, or is there something I don't understand?

As a version, the dog is buried in the indicator buffer, as it is a type double.

//+------------------------------------------------------------------+
//|                                                   WinData_v1.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2

string g_DataTimeValue;

double WinDataBuffer[];
double WinNumberBarBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   IndicatorDigits(0);//(8)

   SetIndexBuffer(0,WinDataBuffer);
   SetIndexStyle(0,DRAW_NONE);

   SetIndexBuffer(1,WinNumberBarBuffer);
   SetIndexStyle(1,DRAW_NONE);

   SetIndexLabel(0,"WinDataTime");
   SetIndexLabel(1,"№ Bara");

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   for(int i=0; i<100; i++)
     {

      g_DataTimeValue=TimeToString(time[i],TIME_DATE|TIME_SECONDS);

      WinDataBuffer[i]=TimeToString(time[i],TIME_DATE|TIME_SECONDS);
      WinNumberBarBuffer[i]=i;
      // WinDataBuffer[i]=StrToDouble(g_DataTimeValue);

      Print(" WinDataBuffer[i] = ",WinDataBuffer[i],"  WinNumberBarBuffer[i] = ",WinNumberBarBuffer[i],
            "  g_DataTimeValue = ",g_DataTimeValue);

     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
Принт:


2014.08.11 15:39:54.016 WinData_v1 EURUSD,M1:  WinDataBuffer[i] = 2014.08  WinNumberBarBuffer[i] = 99.0  g_DataTimeValue = 2014.08.06 11:41:00



 

Good afternoon, comrades!

This is the first time on the forum, so don't kick me if this is an old-fashioned question...

How to open trades in cycle after a certain interval (every minute, for example) ?

In advance, thank you
 
vld:

tu evillive

Looks like it's not that simple, or is there something I don't understand?

As a version, the dog is buried in the indicator buffer, as it is a type double.


Why do you put the string in the indicator buffer?
 
Sanyo:

Good afternoon, comrades!

This is the first time on the forum, so don't kick me if this is an old-fashioned question...

How to open trades in a cycle at a certain interval (every minute for example) ?

Thank you in advance.

By checking the opening of a new bar of the appropriate TF!
 
Sanyo:

Good afternoon, comrades!

This is the first time on the forum, so don't kick me if this is an old-fashioned question...

How to open trades in a cycle at a certain interval (every minute for example) ?

Thank you in advance.
Read about OnTimer()
 

Hello, I have this question:

MT4 has great possibilities for expert optimisation, but is there any tool to optimise indicators? If I want to optimize an indicator's parameters so that its readings were maximally "correct", is it true, that the only way to do it is to write an ekspert on its basis and run it through the history?

And I also would like to know if MT-4 has a custom criterion of optimizing of Expert Advisors like in MT5?

 

Guys I forgot...

How to get an array of current orders and loop through it. And loop to get the order information. MT4, thanks...

 
Vinin:

Why do you shove the string in the indicator buffer?

I understand the absurdity of this action, but I don't understand how to use the indicator

display bar time in the terminal data window in the format "yyyyy.mm.dd" and "hh:mi" (as the first and second lines in the terminal data window)

The indicator buffer will either output the time in seconds from 00:00 1 January 1970 by assigning to it time[i],

or after conversion(TimeToString) truncated date or time.

And if there is a possibility to display it using custom MQL tools, advise how to do it? Thanks in advance!

 
vld:

I understand the absurdity of this action,

but if you explain it, maybe we can understand and explain it to you.