[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 107

 
Is there an indicator of support and resistance levels on this site for the trading day, that was not redrawable. It was also possible to choose for which candles it should be redrawn (Daily, Monthly, Week). If I wanted to use this indicator as a basis for my own estimations, I would not have to look at them too closely, but I would expect to get a good results.
 

Pupersa, найди этот ордер и измени в нём параметр "стоплосс", ничё сложного.


If you don't mind, can you elaborate?
 
artmedia70:
Let me give you the nut and you tell me why the car won't start... :)


With the right nut, you can tell me... :-)

Attached is the file... Thanks in advance!

Files:
demo1.3.1.mq4  36 kb
 
Pupersa:

If you don't mind, can you elaborate?
Search for "work with orders" in a textbook or documentation. use the order search function to find an order according to your parameters, change it with the order modification function.
 

Please help me find a bug in the script.

The essence of the problem is to have 4 files with the values need to open each file, write everything to an array and calculate the average maximum and minimum values and then pass it to another array.

The error is this: when I call GetFileData();, ArrInsertInt(InsertArr, MathAbs(StrToInteger(value)); it starts to add values and not write them again.

string FNLenUp;//имя файла для записи\чтения длин восходящего движения
string FNSpeedUp;//имя файла для записи\чтения скорости восходящего движения
string FNLenDown;//имя файла для записи\чтения длин восходящего движения
string FNSpeedDown;//имя файла для записи\чтения скорости восходящего движения 
//----------------------------------------------------------------------------------------------------------//
int SpeedArrUp[];//массив времени фиксации цен восходящего
int LengthArrUp[];//массив цен восходящего
int SpeedArrDown[];//массив времени фиксации цен нисходящего
int LengthArrDown[];//массив цен нисходящего
extern double percent = 0.005;//пункты
int init()
{
    GetNameF();
    GetFileData(FNLenUp,LengthArrUp);
    GetFileData(FNSpeedUp,SpeedArrUp);
    GetFileData(FNLenDown,LengthArrDown);
    GetFileData(FNSpeedDown,SpeedArrDown);
    
}
int GetFileData (string FileName, int& RetArr[])
{

     
    int Handle = 0;//файловый указатель
    int i = 0;
    int F_newFile = -1;//Флаг создания нового файла (1)-да (0)-нет
    int InsertArr[];//Массив для извлечения в него данных из файла
    int ArrSize = -1;//Размер массива
    int ArrMax = -1;//Максимальное значение
    int ArrMin = -1;//Минимальное значение
    int ArrAverage = -1;//Среднее значение
    string value = 0;
    //---------------------------------------------------------------------//
    //Print(ArrSize);
    //Смотрим существует ли файл


      //И меняем флаг что файл не создавался 
      F_newFile = 0;
      //значит открываем его для чтения
      Handle=FileOpen("lengthEURUSD0.0050Down.csv", FILE_READ);
      if(Handle<1)
      {
         Print("Ошибка открытия файла для чтения.");
         return(0);
      }
      FileSeek(Handle, 0, SEEK_SET);
      while(FileIsEnding(Handle)==false)  
      {                                
         value =FileReadString(Handle);
         if(value!="")
         {
            //Записываем всё в массив из файла
            ArrInsertInt(InsertArr, MathAbs(StrToInteger(value)));
         }  
         if(FileIsEnding(Handle)==true)
         {
            break;
         }     
      }
      //Рассчитываем значения средние максимальные и т.д.
      ArrSize = ArraySize(InsertArr);
      Print(ArrSize);
      //---------------------------------------------------------------------//
      ArrMax = ArrayMaximum(InsertArr,ArrSize,0);
      ArrMax = InsertArr[ArrMax];
      //---------------------------------------------------------------------//      
      ArrMin = ArrayMinimum(InsertArr,ArrSize,0);
      ArrMin = InsertArr[ArrMin];
      //---------------------------------------------------------------------//      
      ArrAverage = 0;
      for(i = 0; i<=ArrSize; i++)
      {
         ArrAverage = ArrAverage+InsertArr[i];
      }
      ArrAverage = ArrAverage/ArrSize;
      //---------------------------------------------------------------------// 
      FileClose(Handle);   

    //---------------------------------------------------------------------//
    //Смотрим если все значения есть, тогда запихиваем всё в массив и передаём его
    if(F_newFile != -1 && ArrSize != -1 && ArrMax != -1 && ArrMin != -1 && ArrAverage != -1)
    { 
      ArrInsertInt(RetArr,F_newFile);
      ArrInsertInt(RetArr,ArrSize);
      ArrInsertInt(RetArr,ArrMax);
      ArrInsertInt(RetArr,ArrMin);
      ArrInsertInt(RetArr,ArrAverage);
      ArrInsertInt(RetArr,Handle);
      Print(RetArr[0],"|",RetArr[1],"|",RetArr[2],"|",RetArr[3],"|",RetArr[4],"|",RetArr[5]);
      return (RetArr);
    }
    //---------------------------------------------------------------------//
    //иначе передаем только файловый указатель
    ArrInsertInt(RetArr,Handle);
    ArrInsertInt(RetArr,F_newFile);    
    return (RetArr);
}
void GetNameF()
{string symbol;//инструмент которым будем торговать
    //создаём имя файла
    symbol = Symbol();
    //---------------------------------------------------------------------------------------------------------------------------//
    FNLenUp = "length"+symbol+DoubleToStr(percent,4)+"up";
    //--------------------------------------------------------//
    FNSpeedUp = "speed"+symbol+DoubleToStr(percent,4)+"up";
    //--------------------------------------------------------//
    FNLenDown = "length"+symbol+DoubleToStr(percent,4)+"Down";
    //--------------------------------------------------------//
    FNSpeedDown = "speed"+symbol+DoubleToStr(percent,4)+"Down";
}
int ArrInsertInt(int& m[], int e, int p=-1) {
  int j, k=ArraySize(m);
   p=-1;

  ArrayResize(m, k+1);
  if (p>=0 && p<k) {
    for (j=k; j>p; j--) m[j]=m[j-1];
    m[p]=e;
  } else m[k]=e;

  return(k+1);
}

here is the script and one of the files

 
puschistic:

Please help me find a bug in the script.

The essence of the problem is to have 4 files with the values need to open each file, write everything to an array and calculate the average maximum and minimum values and then pass it to another array.

The error is this: when I call GetFileData();, ArrInsertInt(InsertArr, MathAbs(StrToInteger(value)); it starts to add values and not write them again.

here's the script and one of the files

The file is not attached for some reason. here are the contents:

121
58
91
176
87
58
105
166
95
54
59
99
54
172
79
55
69
110
97
80
119
113
124
68
80
79
51
84
58
112
51
181

 
Is it possible to see a variable in MetaEditor, for example in red or something else?
 
MQL4. How do I create a dialog box with a single input field?
 
API, ... DLL
 

I'm trying to compare the SAR parabolic, the current one and the previous one. But it doesn't work, I've been struggling for a day. Why doesn't this code work? Here is the script code:

int start()
{
   double sar0 = iSAR(Symbol(), 0, 0.02, 0.2, 0);
   double sar2 = iSAR(Symbol(), 0, 0.02, 0.2, 1);
   sar0 = sar2;
      if (sar0 == sar2)                            //если написать sar0 = sar2,
         Alert("SAR проверяется");                 //то работает, как в коде ниже
   return;
}
This variant works:
int start()
{
   double sar0 = iSAR(Symbol(), 0, 0.02, 0.2, 0);
   double sar2 = iSAR(Symbol(), 0, 0.02, 0.2, 1);
         Alert("sar0 до присваивания: ", sar0, "sar2 до присваивания: ", sar2); 
   sar0 = sar2;
   //if (sar0 == sar2)                              //если написать sar0 = sar2,
      Alert("sar0 после присваивания: ", sar0, 
      "sar2 после присваивания: ", sar2);             //то работает.
   return;
}
Reason: