Questions from a "dummy" - page 130

 
Omg... go read on.
 

Good!

Win7 I couldn't find anything in the forum, what about the working directory of the program? As it seemed to me, in win7 at the moment of start-up a temporary directory is created where all the program is copied, so, when working with MetaEditor it turns out that I copy a file to include, for example on the D drive, but there is nothing in the metaeditor window. I call "Open folder" from the metaeditor window and the window appears on the C drive somewhere in the temp. What to do? How to sync them or prohibit win7 from splitting them like this?

Thank you!

Документация по MQL5: Файловые операции / FileCopy
Документация по MQL5: Файловые операции / FileCopy
  • www.mql5.com
Файловые операции / FileCopy - Документация по MQL5
 
bivmail:

Hi!

Win7 I couldn't find anything in the forum, what about the working directory of the program? As it seemed to me, in win7 at the moment of start-up a temporary directory is created where all the program is copied, so, when working with MetaEditor it turns out that I copy a file to include, for example on the D drive, but there is nothing in the metaeditor window. I call "Open folder" from the metaeditor window and the window appears on the C drive somewhere in the temp. What to do? How to sync them or prohibit win7 from splitting them like this?

Thank you!

https://www.mql5.com/ru/forum/1111/page712#comment_173757
 
TheXpert:

1. Every language has its own sphere of application. To say that a language is "the most advanced" in general is absurd.

2. What difference does it make what it's called? The essence is almost the same.

1. ok, i agree. then mql5 is the most advanced language for auto-trading. :) Let's keep pushing it.

2... That's it, we're asking, we're asking!

Vladix:
2. Supported by

We are all asking for it collectively!

:)

 
Hi all.
are elementary questions about the mql5 language asked here? :-)
judging by the discussion, there're only hell-oops here...
 
GameOver:
Hi all.
are elementary questions about the mql5 language asked here? :-)
I don't know, but judging by the discussion, there are only infernal OOP-ers here...

There are always dummies of different calibers. Well, you can make a branch "for lamers", if you feel more comfortable there ;-).
 
In an effort to master this syntactic creation, believing in the "simplicity" of the language,
started drawing a rudimentary script.
Anyway, one note and one question.

void OnStart() {
   MqlRates  aBars[];
   ArraySetAsSeries(aBars,true);
   int maxBars=TerminalInfoInteger(TERMINAL_MAXBARS); , bad_bars=0;
   int bars=CopyRates(Symbol(),Period(),0,maxBars,aBars);

Alas, if the number of bars is set as Unlimited, the script doesn't work,
it says there is not enough memory. i.e. a call ofTerminalInfoInteger(TERMINAL_MAXBARS) actually turns out to be

which is strange, because in reality there are no more than 100 000 bars on the chart.
How can I get the number of really loaded bars? Because copywriters simply have no time to return anything...

the second question is this.
trying to implement an elementary check (it was elementary in µl4)

      // delete bad day of week and bad bars
      if (TimeDayOfWeek(Time[i])<1 || TimeDayOfWeek(Time[i])>5 || (High[i]-Low[i])<10*Point) { errBar++; continue; }

forum searches (mql5 help search on the phrases day_of_week, dayofweek gave nothing... very useful help!) led to the following implementation

MqlDateTime temp;
TimeToStruct(aBars[i].time,temp);
if (temp.day_of_week<1 || temp.day_of_week>5 ||  aBars[i].high-aBars[i].low<10*Point() ) {errBar++; continue;}

like right? instead of one line there are three - and it's elementary.
is it possible to simplify it? or are all elementary operations now replaced by cumbersome creation of objects, classes, intermediate structures?

Документация по MQL5: Основы языка / Операторы / Оператор создания объекта new
Документация по MQL5: Основы языка / Операторы / Оператор создания объекта new
  • www.mql5.com
Основы языка / Операторы / Оператор создания объекта new - Документация по MQL5
 

Good day!

Could you please advise whether there are brokers in Russia who offer Metatrader as a terminal for working on the FORTS and MICEX?

 

Please suggest a faster variant of "roulette" algorithm than this one:

//——————————————————————————————————————————————————————————————————————————————
// Рулетка.
int Selection()
{
  //----------------------------------------------------------------------------
  int    i=0,u=0;
  double p=0.0,start=0.0;
  double          fit[][2];
  ArrayResize(fit,SizeOfPop);
  ArrayInitialize(fit,0.0);
  double delta=(Population[0][0]-Population[0][SizeOfPop-1])*0.1-Population[0][SizeOfPop-1];
  //----------------------------------------------------------------------------
  for(i=0;i<SizeOfPop;i++)
  {
    fit[i][0]=start;
    fit[i][1]=start+MathAbs(Population[0][i]+delta);
    start=fit[i][1];
  }
  p=RNDfromCI(fit[0][0],fit[SizeOfPop-1][1]);

  for(u=0;u<SizeOfPop;u++)
    if((fit[u][0]<=p && p<fit[u][1]) || p==fit[u][1])
      break;
    //--------------------------------------------------------------------------
  return(u);
}
//——————————————————————————————————————————————————————————————————————————————
It's clear that arrays can be taken out of the function so they don't have to be declared every time and resized, but I need a more revolutionary solution. :)
 
GameOver:
In my attempts to master this syntax creation, believing in the "simplicity" of the language,
started drawing a rudimentary script.
Anyway, one note and one question.

void OnStart() {
   MqlRates  aBars[];
   ArraySetAsSeries(aBars,true);
   int maxBars=TerminalInfoInteger(TERMINAL_MAXBARS); , bad_bars=0;
   int bars=CopyRates(Symbol(),Period(),0,maxBars,aBars);

Alas, if the number of bars is set as Unlimited, the script does not work,
it says there is not enough memory. i.e. in essence, theTerminalInfoInteger(TERMINAL_MAXBARS) will be called;

which is strange, because in reality there are no more than 100 000 bars on the chart.
How can I get the number of really loaded bars? Because copyrights has no time to return anything...

Let's try to figure it out. For CopyRates() function the penultimate parameter

int              count,             // сколько копируем
I.e. the number of elements to be copied. In your design, the number of elements is Unlimited. Roughly speaking, unreal :) That's probably what happens when you work, constantly redistributing memory until it is exhausted. Try to use a more specific value, instead of TerminalInfoInteger(TERMINAL_MAXBARS):MQL5 Reference / Access to timeseries and indicators / Bars
Reason: