[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 186

 
Dimka-novitsek:
I'm curious, what's wrong with my version?

In your version, firstly it falls asleep 300 times in 1 calculation

Secondly, it gets tired of creating a message 600 times on every tick.

And third, it draws this red line on the chart. The red line has a maximum of 0.86, and the green line has a minimum of 1.34

so you can't see the results.

 
ScioMe:

It does draw green, but only at the candle before it closes! Before that, it never does.

I think it should draw only if you change StopLoss and/or TakeProfit
 
pyatka__ASD:

Good afternoon.Please help.

How do I find a pattern of bar shifts calculated using this formula? ObjectGetShiftByValue

what is the pattern
 

I don't see any results.

Thank you!!! I'm a lamb!

 
eddy:
I think it should only draw if you change StopLoss and/or TakeProfit

I do, the log confirms it.
 
well he changes them at the opening bar
 

A question about some of the nuances of calling WinAPI functions.

There is a function GetPrivateProfileStringA.

Import of the function into mql.

#import "kernel32.dll"
  int GetPrivateProfileStringA
      ( string SectionName,    // Наименование секции
        string KeyName,        // Наименование параметра
        string Default,        // Значение по умолчанию
        string ReturnedString, // Возвращаемое значение параметра
        int    nSize,          // Размер буфера под значение параметра
        string FileName);      // Полное имя файла
  int WritePrivateProfileStringA
      ( string SectionName,    // Наименование секции
        string KeyName,        // Наименование параметра
        string sString,        // Записываемое значение параметра
        string FileName);      // Полное имя файла
#import

Description of one of the parameters:

lpKeyName [in] 

The name of the key whose associated string is to be retrieved. 
If this parameter is NULL, all key names in the section specified by the lpAppName parameter 
are copied to the buffer specified by the lpReturnedString parameter.

Question - how to pass "real NULL"?

Passing "mql NULL" (also "" string) got default value instead of list of "keys in section".

lpDefault [in] 
A default string. If the lpKeyName key cannot be found in the initialization file, 
GetPrivateProfileString copies the default string to the lpReturnedString buffer. 
If this parameter is NULL, the default is an empty string, "".

I`ve mentioned "real NULL" because I`ve read about similar problem (exactly with this function) on some forum about Basic. The forum was English-speaking (i.e. everything I could understand was not true), and the problem was solved by means of Basics.

 
eddy:
well, it changes them on the open bar


As far as I understand, OrderModify() can also change stops on bars other than the open bar? My code (almost all from S. Kovalev's book) is built so that stops are changed not only during the open, but also upon the occurrence of some events:

 switch(Tip)                                  // По типу ордера
   {
      case 0 :                                // Ордер Buy
         if (NormalizeDouble(SL,Digits)<     // Если ниже желаем.
            NormalizeDouble(Bid-TS*Point,Digits))
               {
      // Ниже я только добавил функцию New_Stop
                  SL=Bid-New_Stop(TS)*Point; // то модифицируем его
                  string Text="Buy ";         // Текст для Buy 
                  Modify=true;                // Назначен к модифи.
               }
               break;
// Функция из этой же книги:
int New_Stop(int Parametr)                      // Проверка стоп-прик.
  {
   int Min_Dist=MarketInfo(Symb,MODE_STOPLEVEL);// Миним. дистанция
   if (Parametr < Min_Dist)                     // Если меньше допуст.
     {
      Parametr=Min_Dist;                        // Установим допуст.
      Alert("Увеличена дистанция стоп-приказа.");
     }
   return(Parametr);                            // Возврат значения
  }
 

Please tell me how to assign the time to the indicator line

val1[]. Or tell me how to do it and what to use because I can't figure it out. Laguerre indicator.
   i=CountBars-1;
   while(i>=0)
   {
      L0A = L0;
      L1A = L1;
      L2A = L2;
      L3A = L3;
      L0 = (1 - gamma)*Close[i] + gamma*L0A;
      L1 = - gamma *L0 + L0A + gamma *L1A;
      L2 = - gamma *L1 + L1A + gamma *L2A;
      L3 = - gamma *L2 + L2A + gamma *L3A;

      CU = 0;
      CD = 0;
      
      if (L0 >= L1) CU = L0 - L1; else CD = L1 - L0;
      if (L1 >= L2) CU = CU + L1 - L2; else CD = CD + L2 - L1;
      if (L2 >= L3) CU = CU + L2 - L3; else CD = CD + L3 - L2;

      if (CU + CD != 0) LRSI = CU / (CU + CD);
      val1[i] = LRSI;
          i--;
        }
         

   if(counted_bars>0)
      counted_bars--;
   
   limit=Bars-counted_bars;
   
   if(limit>CountBars)
      limit=CountBars;
  
   for(int c=1;c<limit;c++)
        
{if(val1[c]>0.45)
   LastLag++;}

For example, when line val1[c] crosses 0.45 upwards time value is set in variable TimeBegin and when it crosses downwards time value is set in variable TimeEnd. And so on through the whole graph.

Files:
 
ScioMe:

As far as I understand, OrderModify() can also change stops on bars other than the opening bar?

Well, the arrows are on the open bar. you only set their colour
Reason: