Beginner's questions in MQL5. Professionals don't pass by. - page 7

 
Artyom Trishkin:

DRAW_NONE == 0

DRAW_LINE == 1

So you have something else somewhere. It's supposed to work for you too.

I can't tell you what it is yet, but it doesn't always work.
 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
 
Artyom Trishkin:

No, you don't have to. Everything is done once at limit>1. This is first run and history loading. And if you have smoothing period_sm=10, then limit in this case should be less by 10. Correspondingly so:

if(limit>1)
  {
   limit=rates_total-period_sm-1;
   ArrayInitialize(Buffer,InitValue);
  }

InitValue - value to initialize the buffer - 0 or EMPTY_VALUE - as appropriate. Or -100500 ...

as you suggest in your example -- this is not the right way to do it -- or, if you don't understand you, give a detailed explanation.

Deciding on what you call "This is the first run and loading history" -- is done by prev_calculated

limit (it is unclear what limit is in your case) - if it is the number of bar, from which the recalculation starts - then the limit here may be more than 1, for example, 5 minutes of no connection - at connection appearance on M1 limit=5, and there is no need to recalculate the indicator from the beginning

you can see in the standard terminal examples how to use everything.

examples from the "Bears" indicator:

MQL4 (numbering of bars from the beginning to the end):

   int limit=rates_total-prev_calculated;
//---
   if(rates_total<=InpBearsPeriod)
      return(0);
//---
   if(prev_calculated>0)
      limit++;
   for(int i=0; i<limit; i++)

MQL5 (numbering of bars from the end to the beginning):

   if(prev_calculated<InpBearsPeriod)
      limit=InpBearsPeriod;
   else limit=prev_calculated-1;
//--- the main loop of calculations
   for(i=limit;i<rates_total && !IsStopped();i++)
 

Hi all. I used to have a demo account on MT-5. I lost my login password to log in to MT-5 after I re-installed my Windows. Now I registered it in web terminal

My demo account MT-5. All ok. I put new login and password to regular MT-5 home terminal. All works, only at opening new order F9,

in a window of new order - buttons Buy and Sell are not active. I cannot place an order. Please, what should I do?

I am sorry, I have to ask.

I have no orders. Thank you.

 
Shara1:

Hi all. I used to have a demo account on MT-5. I lost my login password to log in to MT-5 after I re-installed my Windows. Now I registered it in web terminal

My demo account MT-5. All ok. I put new login and password to regular MT-5 home terminal. All works, only at opening new order F9,

in a window of new order - buttons Buy and Sell are not active. I cannot place an order. Please, what should I do?

I am sorry, I have to ask.

Thank you.

I have understood the problem. I had 0,00 in the new order window F9 and the volume was 0,00. I put 0.01 and it worked.

 

Hello, please advise, there are these strings in some Expert Advisors.

  double highest=DBL_MIN,lowest=DBL_MAX;

Question - what are the variables equated to these constants DBL_MIN, DBL_MAX for?

 
refounder83:

Hello, please advise, there are these strings in some Expert Advisors.

My question is - what are the variables equated to these constants DBL_MIN and DBL_MAX for?

To compare them to real data which are obviously less than DBL_MAX and obviously more than DBL_MIN.

For example:

double x=DBL_MIN;
int total=ArraySize(array);
for(int i=0; i<total; i++)
  {
   double y=array[i];  
   if(y>x) x=y;
  }
Print("x=",DoubleToString(x,Digits()));
 
Thank you, I see.)
 

Is this procedure done to convert server time into seconds?

datetime time=TimeTradeServer()+60*60*24;
   
  
 
refounder83:

Is this procedure done to convert server time into seconds?

This is "server time" plus one day (60 seconds * 60 minutes * 24 hours)

You can use PeriodSeconds()

Print("PeriodSeconds(PERIOD_D1)=",PeriodSeconds(PERIOD_D1),", PeriodSeconds(PERIOD_H1)*24=",PeriodSeconds(PERIOD_H1)*24,", 60*60*24=",60*60*24);
Reason: