[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 649

 
7sintez:
Thank you all so much for all your help! The codes I haven't used yet - copied them into notepad! I'll look into them when I have the time! Thanks again and again and again Friends!


You can use Igor Kim's libraries


//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.02.2008                                                     |
//|  Описание : Возвращает номер бара открытия последней позиции или -1.       |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   ("" или NULL - текущий символ)          |
//|    tf - таймфрейм                  (    0       - текущий таймфрейм)       |
//|    op - операция                   (   -1       - любая позиция)           |
//|    mn - MagicNumber                (   -1       - любой магик)             |
//+----------------------------------------------------------------------------+
int NumberOfBarOpenLastPos(string sy="0", int tf=0, int op=-1, int mn=-1) {
  datetime t;
  int      i, k=OrdersTotal();

  if (sy=="" || sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==sy) {
        if (OrderType()==OP_BUY || OrderType()==OP_SELL) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderOpenTime()) t=OrderOpenTime();
            }
          }
        }
      }
    }
  }
  return(iBarShift(sy, tf, t, True));
}

 

It's a little more complicated than that.

 
r772ra:


You can use Igor Kim's libraries

It's a little more complicated than that.


I already used your code! Everything works! Thank you!

 
How do you patch holes in quotes from mtqs or how do you recalculate full minute quotes for all TFs?
 
Qwertee: ok, another thing in my EA is this branching:

if(period=="M15")
{
//check to open buy
Alert(buysell);

if(buysell=="buy")

Alert(1);

.............

}

Basically, nested if. BUT. condition if(period=="M15") is fulfilled and Alert gives a result, and buy, but condition if(buysell=="buy") is not fulfilled and Alert(1) command is not even started. Damn, but both conditions are even syntactically the same, but why one is fulfilled and the other is not?

Technically it's simple: buysell !="buy" - so the next Alert(1) is not executed.

What buysel variable contains at that moment is found out by print: Print (buysell); after the first Alert.

------------------------------------------------------------------------------------------------------------------------------------------------

That's the problem, if I put Print(buysell) instead of Alert(1) in my code, buysell will return value buy, so what's wrong?

 

There is a function in which one of the parameters is an array: FunctionTest(double OneDimensionalArray[7]) ...

There is a three-dimensional array: double Three-dimensionalArray[1][2][7].

The task is to insert the last dimension of the Three Dimensional Array as a parameter into a function. I'm trying to do it, but the compiler frowns.

I do it like this: FunctionTest(ThreeDimensionalArray[0][0]) .

Could you please tell me what I'm doing wrong and how to solve this problem?

Thank you in advance.

 
artem179:

There is a function in which one of the parameters is an array: FunctionTest(double OneDimensionalArray[7]) ...

There is a three-dimensional array: double Three-dimensionalArray[1][2][7].

The task is to insert the last dimension of the Three Dimensional Array as a parameter into a function. I'm trying to do it, but the compiler frowns.

I do it like this: FunctionTest(ThreeDimensionalArray[0][0]) .

Could you please tell me what I'm doing wrong and how to solve this problem?

Thank you in advance.

They say Catherine the Great made up to 4 mistakes in a 3-letter word.

Don't solve such a problem yet. Find an easier solution...

 
tara:

Catherine the Great is said to have made up to four mistakes in a 3-letter word.

Don't solve such a problem yet. Find an easier solution...


In principle, I've already solved it another way. But it's still interesting, at least purely theoretically. After all, a three-dimensional array[0][0] should be a one-dimensional array, right? If so, how can I get a one-dimensional array from a three-dimensional one?
 
artem179:

In principle, already solved in another way. But it's still interesting, at least purely theoretically. After all, three-dimensionalArray[0][0] is supposed to be a one-dimensional array? If so, how can I get a one-dimensional array from a three-dimensional one?

Looking at the buy?
1. Arrays are always static

2. You don't need to get it from 3D, just create it correctly.

 
artem179:

In principle, I've already solved it another way. But it's still interesting, at least purely theoretically. After all, a three-dimensional array[0][0] should be a one-dimensional array, right? If so, how to get a one-dimensional array out of a three-dimensional one?
An N-dimensional array is a one-dimensional array. It is just divided into dimensions for convenience.
 
And what do you think, Vadim? How comfortable is it to navigate in * measurements? ))) However, I've known people who could count the tesseract facets in their head. But I'm not sure that this has anything to do with our problems.
The question is the formulation of the problem. Here you don't need it. One-dimensional, of course.
Reason: