Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1678

 
Сергей Таболин #:

But the question is why is there no access to

???

Yes and to

и

???

and why separate access when their values can be defined via define ???

think of it as a pragma in C/C++ - an instruction to the compiler

 
Maxim Kuznetsov #:

why separate access when their values can be defined via define ???

Think of it as a pragma in C/C++ - an instruction to the compiler

This is additional code, not quite good, you need direct access.

Now I have it like this (hint from forum), but I'd like to avoid define

#define    release   "1.15"
#property version release // release уже можно прочитать в программе
 
Vitaly Muzichenko #:

This is additional code, not really good, you need direct access

Now I have it like this (hint from forum), but I'd like to avoid define

property can be put to each file individually (i.e. repeatedly and in different places), they have different scope than defines and variables. They are handled a little differently.

I don't see a logical method to move a property to const variables or defines. Backwards, yes, but not there :-)

 
Can you give me a trick (maneuver) to force the terminal to remember multiple values?

For example, a task:

Given N candles backwards. Find candlesticks with size >= X pips, memorize their number and size of each of them. If the current candle after closing is >= X pips, then compare its size with the total number of calculated candles and print the result - what is its size among all the candles found.
 
Ivan Butko #:
Can you please suggest a trick (maneuver) to make the terminal remember multiple values?

For example, a task:

Given N candles backwards. Find candlesticks with size >= X pips, memorize their number and size of each of them. If the current candle after closing was >= X pips, then compare its size with the total number of calculated candles and display the result - what is its size among all the candles found.

The terminal remembers everything... the quotes archive!

And for the Expert Advisor or indicator you need this

 
Fast235 #property version"1.07", no such possibility? program name is there, why version is not there as well?

Define and assign the version in the code. No cheaper option.
 
Maxim Kuznetsov #:

like this:

That's even a line and a variable less)
 

I can't understand why there's an endless spell here

int GetMagic(Order &order)
{
  int magic = 0;
  //Если должен быть открыт стопордер и если есть уже открытые или отложенные 
  //ордера, то возможно некоторые с маджиком, это надо проверить и сгенерировать 
  //для нашего ордера уникальный маджик и отправить его на запись в массив
  if(order.cmd == OP_SELLSTOP || OP_BUYSTOP)
    if(OrdersTotal() >= 1)
      for(;;){
        magic++;
        for(int i = OrdersTotal(); i > 0 ; i --)
          if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES) != false)
            if(magic != OrderMagicNumber())
              return magic;
            
      }
    //Если нет открытых или отложенных ордеров то увеличиваем значение 
    //маджика, чтобы он равнялся единице и отправляем на запись в массив
    else if (OrdersTotal() == 0)
      return (magic + 1);
  return magic;
}
 
Nerd Trader #:

I can't figure out why there's an endless spell

is this a joke?

You have it in black and white for(;;)

 

Good afternoon.

Can you please tell me what function OrderSwap() is which returns the swap value of the currently selected order.

What if there is a grid of orders?

Does anyone have a function to calculate the sum of all swaps of a grid of orders for a magic order and a financial instrument.

Thanks for the help!!!

Reason: