Questions from Beginners MQL5 MT5 MetaTrader 5 - page 510

 

Let's get ready:

enum ENUM_case
  {
   M=1,// Больше A
   L=2,// Меньше A
   ML=3,//Больше А и меньше Б
   LM=4 //Меньше А или больше Б
  };

struct param
  {
   int               cas; //Case
   double            a; // A
   double            b; //B  
  };
param params[];
double data[3]; //Массив для записи текущих параметров

Define the variables

sinput string atata0; //Параметры пробитие 
sinput string atata1; //Объем
input ENUM_case bc1=1; //Логика
input double ba1=1;//A
input double bb1=1;//B
sinput string atata2; //Сделки
input ENUM_case bc2=1;//Логика
input double ba2=1;//A
input double bb2=1;//B
sinput string atata3; //Заявки
input ENUM_case bc3=1;//Логика
input double ba3=1;//A
input double bb3=1;//B

The idiocy in OnInit looks like this:

   ArrayResize(params,3);
   params[0].cas=bc1;
   params[0].a=ba1;
   params[0].b=bb1;
   params[1].cas=bc2;
...

I don't understand why we can't write input variables immediately to an array or initialize an array with variables :(

Somewhere inside the EA, we fill in the data array and run the check function:

bool Conditions()
{
int num=ArraySize(params);
for (int i=0;i<num;i++)
{
switch(params[i].cas) 
{
case 1 : if (!(data[i]>=params[i].a)){return(false);break;}
case 2 : if (!(data[i]<=params[i].a)){return(false);break;}
case 3 : if (!(data[i]>=params[i].a && data[i]<=params[i].b)){return(false);break;}
case 4 : if (!(data[i]<=params[i].a || data[i]>=params[i].b)){return(false);break;}
}
}
return(true);
}

So far so good. Are there any better options?

 

Hello!

I can't buy the software I like from the Market (MT4).

I seem to have done everything correctly:

first funded my MQL5.community account (via WM),

Then registered an account in MT4.


But when I pressed "buy" or "rent" (for 1 year, I wanted to).

-I do not withdraw from the funded account,

And offer to take again from WM, substituting the form of filling WM

(and, accordingly, offering to specify and the password from Webmoney).


It seemed a little strange to me.

-Why have I deposited my MQL5.community account then?


If you know something, may be it is something I do not understand?


Thanks in advance


============

Thank you, I didn't wait for an answer and figured it out on my own. _it's OK

 
Антон:

Let's get ready:

Define the variables

The idiocy in OnInit looks like this:

I don't understand why you can't write input variables immediately to an array or initialize an array with variables :(

Somewhere inside the EA, we fill in the data array and run the check function:

So far so good. Are there any better options?

Everything seems to be fine at first glance. What do you have a problem with?

I don't understand why you can't write input variables directly into an array or initialize an array with variables :(
The array can only be initialized with constants, because the initialization code is created at compile time and at this point the values of variables are unknown.

Another criticism purely on design. You have ENUM_case and still use numeric values.

 
Alexey Volchanskiy:

Everything seems fine at first glance. What's not to like?

I don't understand why you can't write input variables directly into an array or initialize an array with variables :(
The array can only be initialized with constants, because the initialization code is created at compile time and at this point the values of variables are unknown.

More quibbles purely on the design. You have ENUM_case and still use numeric values.

Once it's ok, I'll refine it. Thanks!
Had a bit of a tiff this morning, thought there might be some tricky operator for such a thing.

 
vaso55555:

Good day!

I cannot buy my favourite application from the Market (MT4).

Seemed to be doing everything right:

I funded my first MQL5.community account (via WM),

Then I registered an account in MT4.


But when I press "buy" or "rent" (for 1 year I want)

-I do not withdraw from the funded account,

And offer to withdraw again from WM, substituting the form of filling WM

(and, accordingly, prompting me to enter my Webmoney password as well)...


It seemed a bit strange to me...

-And then why did I deposit my MQL5.community account?


If someone knows, may be there is something I do not understand...


Thanks in advance

You should withdraw from the internal account, at least I had it always, when the signals subscribed, but that market that the signal the essence of payment is the same. On the internal account sufficient funds for payment in the market?
 
Антон:

Once it's OK, I'll refine it. Thank you!
Had a bit of a tiff this morning, thought there might be some tricky operator for such a thing.

I've always said, don't optimise a program during development, don't waste time on it. First write a clear, understandable and profitable algorithm, and then, if necessary, optimize the bottlenecks .
 
Vladimir Zubov:
It should be taken from the internal account, at least that's how it has always been when subscribing to signals, but the marketplace and the signal are the same. I have enough money on my internal account to pay in the market ?
I have already sorted it out, thank you.
 

Hello, is there any way to determine the tester's mode of operation in relation to prices:

- at the opening prices,
- ohlc
- all ticks?


 
elibrarius:

Hello, is there any way to determine the tester's mode of operation in relation to prices:

- at the opening prices,
- ohlc
- all ticks?


There are appropriate drop-down windows with modes.
 
Alexey Volchanskiy:
There are corresponding dropdown windows with modes.

I can set the mode, but the Expert Advisor needs to know in which mode (by prices) it is running when testing.

I can think of only 1 variant,

if there was only 1 tick during a bar, then it would be opened at prices,
if there were 4 ticks at 0, 20, 40, 59 seconds - ohlc
otherwise - all ticks.

But I'm afraid there may be variants that will coincide with someone else's condition to determine the type
Maybe there is an easier option?