Question for connoisseurs - page 19

 

Question on the Gann line tools.

The Gunn line is "built at a forty-five degree angle ", inthe GunnGrid too, the lines "built at a 45 degree angle ". Should be a coincidence, IMHO, but they don't!

 
hedger:

Question on the Gann line tools.

The Gunn line is "built at a forty-five degree angle ", inthe Gunngrid, too, the lines "built at a 45 degree angle ". Should be a coincidence, IMHO, but they don't!

The correct angle is 40 degrees, Mendeleev established.

45 degrees is Siberian.

 
hedger:

Question on the Gann line tools.

The Gunn line is "built at a forty-five degree angle ", inthe Gunngrid, too, the lines "built at a 45 degree angle ". Should be a coincidence, IMHO, but they don't!


And where did you find the degrees?
 
Vinin:

Where did you find degrees?

Right here: https://www.metatrader5.com/ru/terminal/help/objects/gann/gann_line

"The Gann Line

The Gann Line is a line drawn at a 45-degree angle. This line is also called "one-to-one" (1x1), which means one change in price per unit time".

And here: https://www.metatrader5.com/ru/terminal/help/objects/gann/gann_grid

"The Gann Grid

Gann Grid represents trends, built at an angle of 45 degrees (Gann Lines)".

 

Good afternoon!

Here is the question. I have slightly modified I.Kim's function and now this function returns the number of the bar where the last pending, bystop or sellstop was set.

//+----------------------------------------------------------------------------+
//|  Автор    : Ким Игорь В. aka KimIV,  http://www.kimiv.ru/                  |
//+----------------------------------------------------------------------------+
//|  Версия   : 19.02.2008                                                     |
//|  Описание : Возвращает номер бара установки последнего ордера или -1.      |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   ("" или NULL - текущий символ)          |
//|    tf - таймфрейм                  (    0       - текущий таймфрейм)       |
//|    op - операция                   (   -1       - любая позиция)           |
//|    mn - MagicNumber                (   -1       - любой магик)             |
//+----------------------------------------------------------------------------+
int NumberOfBarOpenLastOPDER(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_BUYSTOP || OrderType()==OP_SELLSTOP) {
          if (op<0 || OrderType()==op) {
            if (mn<0 || OrderMagicNumber()==mn) {
              if (t<OrderOpenTime()) t=OrderOpenTime();
            }
          }
        }
      }
    }
  }
  return(iBarShift(sy, tf, t, True));
}

Besides, I need almost the same function. But it should return the number of the bar where not the last, but the very first of all stops have been set on the chart!

I cannot do it. Please, tell me. - how to do it?

 
Rita:

Good afternoon!

Here is the question. I have slightly modified I.Kim's function and now this function returns the number of the bar where the last pending, bystop or sellstop was set.

Besides, I need almost the same function. But it should return the number of the bar where not the last, but the very first of all stops have been set on the chart!

I cannot do it. Please, tell me. - how to do it?

Set the initial value of t higher and change the sign in the condition
 if (t<OrderOpenTime())

на противоположный.
 

Spsb. I changed the sign. But the function isn't working yet. I put it in the comment. It keeps returning -1.

Also, I don't quite understand. Where and how to set a bigger initial value of t ?

 
Rita:

Spsb. I changed the sign. But the function isn't working yet. I put it in the comment. It keeps returning -1.

Also, I don't quite understand. Where and how to set a bigger initial value of t ?

datetime t;
t = TimeCurrent();

You could just set the current time.
 
Rita:

Good afternoon!

Here is the question. I have slightly modified I.Kim's function and now this function returns the number of the bar where the last pending, bystop or sellstop was set.

Besides, I need almost the same function. But it should return the number of the bar where not the last, but the very first of all stops have been set on the chart!

I cannot do it. Please, tell me. - how to do it?


Something like this

int NumberOfBarOpenFirstOPDER(string sy="0", int tf=0, int op=-1, int mn=-1) {
   datetime t=TimeCurrent();
   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 (op<0 || OrderType()==op) {
               if (mn<0 || OrderMagicNumber()==mn) {
                  if (t>OrderOpenTime()) t=OrderOpenTime();
               }
            }
         }
      }
   }
   return(iBarShift(sy, tf, t, True));
}
 
Thank you all. It worked! The function is working!