Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1274

 
Igor Makanu:

it worked, here is the code from@fxsaber

you can now write Close[1] > Close[2 ]

This will work. thought mt4steel should solve the problem. will try it now. thanks

 
Valeriy Yastremskiy:

Close[shift] has square brackets. it didn't work.

Am I right in the timeseries the numbering in 5 is the same as in 4?

No it isn't. In this case it's just a coincidence of interests)))

 
Igor Makanu:

it worked, here is the code from@fxsaber

you can now write Close[1] > Close[2 ]

I obtained an indicator.

var1=TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS); //не получилось все дефайнами заменить в лоб. пришлось просто заменить.

Now I have to deal with type conversion.

Of course, it is clear that MT5 is closer to the market. But this craving for long names is not clear to me.

 
Valeriy Yastremskiy:

I was able to move the indicator.

All that's left is to deal with the type conversion.

Of course it is clear that MT5 is closer to the market. But I don't understand the craving for long names.

TimeToString(TimeCurrent(),TIME_DATE|TIME_SECONDS);
 
Vitaly Muzichenko:

Yes)))) Funny thing happened, I found only conversion to structure, (in the directory to structure and to text in different places), redid it, and only then came the idea that in 5ka there must be a conversion to text)))) happens.

And long names are needed for a reason)))

 

For some reason this code reads: 2021.01.16 20:24:53.543 (FUTSP500CONT,H1) 1980.12.31 03:00:00

But the zero bar has another time. Outputs this error with low frequency one time out of 20-40 in indicator.

It happens at start of the indicator, I get it if it is normal, then it works no error.

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[])

{
Print(time[0]);
}




 
BillionerClub:

For some reason this code reads: 2021.01.16 20:24:53.543 (FUTSP500CONT,H1) 1980.12.31 03:00:00

At the same time zero bar has another time. Outputs this error with low frequency one time out of 20-40 in indicator.

It happens at start of indicator, I get it if it is ok, it works, but there is no error.




Please post your question to newbies branch:Questions from Beginners MQL5 MT5 MetaTrader 5

Here is a code for you to study (if you don't want to read help).

//+------------------------------------------------------------------+
//|                                               Test Indicator.mq5 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping

//---
   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[])
  {
//---
   Print("time[0]: ",TimeToString(time[0],TIME_DATE|TIME_MINUTES),", time[rates_total-1]: ",TimeToString(time[rates_total-1],TIME_DATE|TIME_MINUTES));
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
Вопросы от начинающих MQL5 MT5 MetaTrader 5
Вопросы от начинающих MQL5 MT5 MetaTrader 5
  • 2012.03.12
  • www.mql5.com
Подскажите пожалуйста, такой показатель тестера в жизни реален? И хороший это или плохой результат за год с депо 3000...
Files:
 
what is the difference between all ticks and every tick based on real ticks ? when testing
 
Aleksandr Egorov:
what is the difference between all ticks and every tick based on real ticks ? when testing

And click on the auto-generated link in your text and read it.))

 
Alexey Viktorov:

And click on the auto-generated link in your text and read it)).

already read it )

Reason: