AutoGraf Series 4 - MQL features. - page 33

 

Ladies and Gentlemen!

Please answer a question.

How and where in the code should you designate external variables?

It's not clear from the example above.

//================================================================================== 4 ==
   double AT[33];                                  // Массив для внешних переменных
   bool New_Parametr = false;                      // Обновления параметров пока не было
   for (int i=0; i<=32; i++)                       // Поищем обновлённый параметр
      {                                            // Если какой-то параметр обновлён..
      if(NormalizeDouble(AT[i], 8) !=  NormalizeDouble(Instrument[0][0][i][0],8))
         {
         New_Parametr = true;                      // .. запоминаем этот факт..         
         for (i=0; i<=32; i++)                     // .. то присвоим новые значения всем
            AT[i] = Instrument[0][0][i][0];        // Для удобства пользования
         break;                                    // .. и выходим из цикла перебора
         }
      }
//================================================================================== 5 ==
   int Strategy = NormalizeDouble(AT[0],0);
   switch(Strategy)
      {

How can I make external variables in the application's settings not be depersonalized AT_1...AT_32, because you can't remember what each number stands for?

 

Values of external variables for strategies are specified (as well as any values of external variables) in the Expert Advisor settings.

You cannot change names of external variables in the Expert Advisor, because they are written in the code of the Expert Advisor AG_exp.ex4.

The names of external variables from the Expert Advisor are passed to the attached file of the strategy via the Instrument array.

The names of local variables in the strategy, corresponding to external variables in the Expert Advisor, can be changed in the strategy.

This is the case in this example:

AT[i] = Instrument[0][0][i][0];        // Для удобства пользования

You can specify your own names if you wish.

For example, instead of AT[i] specify Alfa, Beta, etc.

Array Instrument [][][]: http://autograf.dp.ua/Pages/2/26/267/2676.htm
Strategies in AG_AT(): http://autograf.dp.ua/Pages/2/26/267/26711/26711_1.htm
Strategies to attach: http://autograf.dp.ua/Pages/2/26/267/26711/26711_2.htm
Examples of coding strategies:
http://autograf.dp.ua/Pages/2/26/267/26712/26712_1.htm
и http://autograf.dp.ua/Pages/2/26/267/26712/26712_2.htm

 

Now I understand. Without any programming experience, I don't get it right away. Thank you.

Если программно, то можно воспользоваться функцией ObjectDelete() или ObjectsDeleteAll().

And where should I put it in my strategy? Or the objects will be created and deleted each time a custom function is called?

 
LeonidSB писал(а) >>

Now I understand. Without any programming experience, I don't get it right away. Thank you.

And where should I put it in my strategy? Or objects will be created and deleted each time user function is called?

It doesn't need to be prescribed in a user function or in a strategy.

Make a simple separate script. After you turn off the strategy, throw it in the window, it will delete all unnecessary things.

(in AG 5 we will have to make some kind of deinit in the strategy; but solution will depend on possibilities of MQL5)

 

Thanks for the sound advice. Only you overestimate me. I haven't dealt with scripts yet, but I'll go in that direction. If possible, please give me a link to an analogue.

I've only got acquainted with the indicator so far.

I have taken TD_Points&Line_mgtd1.1.mq4 by Vladislav Goshkov (VG) as an analogue, added log.mq4 Copyright © 2006, komposter for report creation and got more than 2 000 lines of my indicator.

I made its scheme. It has about 500 lines. I may cut it up, but it is ok for now.

By icon

// --- // ---

is the cut out places.

For now I have the structure in mind, so I want to achieve the desired functionality. Then we'll comb everything according to the rules (the cost of quality is geometrically progressive).

Well, the SRC can't insert 521 lines: "text is larger than allowed size". We'll have to attach the file

Files:
 

At this stage you need to become familiar with the special functions and types of applications.

The best way to do this is to take the MQL4 textbook and read from the beginning, one by one. If you have any questions, post them, I'll try to answer them.

 
SK. >> :

At this stage you need to become familiar with the special functions and types of applications.

The best way to do this is to take the MQL4 textbook and read from the beginning, one by one. If you have any questions, post them, I'll try to answer them.

Your manual is my reference book. I downloaded and printed it and use it all the time.

Questions arise if I don't understand the gist of what I'm reading or if some issues are not covered.

There are two samples with writing data into an external file or reading from a news file and this is one call to the Start() function. More than a month of messing around until Andrey Khatimlianskii (komposter) found the example which made what I need. Namely: init() - formation of report's table header (about 30 columns), start() - formation of row with parameters of each deal of session, deinit() - formation of session's result. And I have made three types of reports (table with parameters for each transaction, column with session totals and table with session totals) and I can use them in different configurations for further processing in Excel. By the way, in deinit() ObjectsDeleteAll(). But that was later, but from the beginning I had made a heap of graphs , so that I could see and analyze everything in the tester and in real life. It helps a lot when programming, because MQL-4 has no debugger, and this way it is possible to see on the chart what lines (opening and closing conditions, objectives, deal lines) the program constructs and how it does it. But it is all within the scope of the indicator and it does not trade real time. Therefore, there is a need to attach to the Expert Advisor to enable non-virtual trading, plus the ability to use the tester report data with the possibility of automatic optimization. And all this without losing the existing functionality implemented so far in the indicator.

Unfortunately, 495 pages of the tutorial, 180 pages of the AutoGraf-4manual, 370 pages ofMetaEditor, MT help , it is impossible to show everything, and the life is not enough to read the forum. But it's just for fun.

At I have made a code scheme of strategy functions (based on indicator algorithm) and I am not sure where and how to put script for ObjectsDeleteAll()there , am I right in plugging trading functions (they are highlighted with "zzzzzzzzzz")? >> Please take a look at this stuff:

 

Strategy function code diagram (based on the indicator algorithm)



//+------------------------------------------------------------------+
//|                                          Shema_3_TD_BLS_21_1.mq4 |  
//|                                 Copyright © 2009, Leonid Belskiy |  
//|                                         leonid.belskiy@gmail.com |   
//+------------------------------------------------------------------+  
#property copyright "Copyright © 2009, Leonid Belskiy"
#property link      "leonid.belskiy@gmail.com"
//жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
#property library                                                                                                        //ж
                                                                                                                         //ж
#import "AG_Lib.ex4"                                                                                                     //ж
    int AG_Magic_Number();                                 // Вычисление MN                                              //ж
    int AG_Message(string & Message[], string _Text);      // Запись сообщений в массив Message[]                        //ж
                                  // Запись управляющих воздействий ф-ии АТ в массив Manager[][]:                        //ж
    int AG_Set_Instr(double & Manager[][], int ii, double v1, double v2, double v3,                                      //ж
                     double v4, double v5, double v6, int io , int ih);                                                  //ж
    int AG_Delete_Instr(double&Manager[][], int ii, int io,int ih);  //Удаление инструментов                             //ж
#import                                                                                                                  //ж
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                                //ж
    int TD_BLS_21_2(int Parol_S, double Order[][], string Object[],                                                      //ж
                    double Instrument[][][][], int Ddraw_Object[][],                                                     //ж
                    double& Tuning[], double& Manager[][], string& Message[])                                            //ж
        {                                                                                                                //ж
         static int Count = 0;                             // Счётчик посещений этого блока                              //ж
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                                //ж
         double Lot= NormalizeDouble(Tuning[1],2);         // Значение лотов                                             //ж
         int Per   = NormalizeDouble(Tuning[2],0);         // Значение % (целое)                                         //ж
         int Slip  = NormalizeDouble(Tuning[3],0);         // Проскальзывание (пунктов)                                  //ж
         int SL    = NormalizeDouble(Tuning[4],0);         // StopLoss (пунктов)                                         //ж
         int TP    = NormalizeDouble(Tuning[5],0);         // TakeProfit (пунктов)                                       //ж 
         int Ds    = NormalizeDouble(Tuning[6],0);         // Дистанция (пунктов)                                        //ж
         int St    = NormalizeDouble(Tuning[7],0);         // Шаг модификации (пунктов)                                  //ж
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                                //ж
         if (Count==0)                                     // Это можно делать один раз в начале                         //ж
             {                                             // Пример сообщения (максимум 62 симв):                       //ж
              AG_Message(Message, "Разработчик J.Smith, http://company.com");                                            //ж
              Count++;                                     // Количество посещений этого блока                           //ж 
                                                                                                                         //ж
              Lot   = 0.1;                                 // Если количество лотов Lot (Tuning[1]) больше нуля, ..      //ж
              Per   = 0;                                   // .. независимо от значения переменной Per (Tuning[2]).      //ж
//              Lot   = 0.0;                                 // 0.0 означает, что колич лотов высчитывается в AutoGraf   //ж
//              Per   = 7;                                   // .. на основе значения % (здесь 7%) суммы баланса         //ж
              Slip  = 1;                                                                                                 //ж   
              SL    = 25;                                                                                                //ж       
              TP    = 100;                                                                                               //ж         
//              Ds    = 20;                                                                                              //ж          
//              St    = 3;                                                                                               //ж          
              Tuning[1] = Lot;                             // Значение лотов                                             //ж          
              Tuning[2] = Per;                             // Значение % (целое)                                         //ж          
              Tuning[3] = Slip;                            // Проскальзывание (пунктов)                                  //ж          
              Tuning[4] = SL;                              // StopLoss (пунктов)                                         //ж          
              Tuning[5] = TP;                              // TakeProfit (пунктов)                                       //ж          
              Tuning[6] = Ds;                              // Дистанция (пунктов)                                        //ж          
              Tuning[7] = St;                              // Шаг модификации (пунктов)                                  //ж          
              AG_Message(Message,"Изменение настроек из АТ.");       // Пример сообщения (макс.62 симв.)                 //ж          
              return(1);                                   // Выход после перенастроек параметров                        //ж          
             }                                                                                                           //ж          
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                                //ж          
         int MN;                                           // MagicNumber в ф-ии AG_Magic_Number()                       //ж          
         string Comm = "AG_AT";                            // Комментарий (рекомендуется "AG_AT")                        //ж          
         static int Ticket;                                // Номер ордера                                               //ж          
         int _Ord_Ticket = 0;                              // Номер ордера                                               //ж          
         double _Ord_Lots = 0;                             // Полное закрытие                                            //ж          
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -                                //ж          
   double AT[33];                                  // Массив для внешних переменных                                      //ж          
   bool New_Parametr = false;                      // Обновления параметров пока не было                                 //ж          
   for (int i=0; i<=32; i++)                       // Поищем обновлённый параметр                                        //ж          
      {                                            // Если какой-то параметр обновлён..                                  //ж          
       AT[1]=11;                                                                                                         //ж          
                                                                                                                         //ж          
      if(NormalizeDouble(AT[i], 8) !=  NormalizeDouble(Instrument[0][0][i][0],8))                                        //ж          
         {                                                                                                               //ж          
         New_Parametr = true;                      // .. запоминаем этот факт..                                          //ж                  
         for (i=0; i<=32; i++)                     // .. то присвоим новые значения всем                                 //ж          
            AT[i] = Instrument[0][0][i][0];        // Для удобства пользования                                           //ж          
         break;                                    // .. и выходим из цикла перебора                                     //ж          
         }                                                                                                               //ж          
      }                                                                                                                  //ж          
//жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
    if((nTime!=Time[0])||(CurPeriod!=Period()))                      // На новом баре или изменении таймфрейма все пересчитываем 
        {                                                            // Period Возвращает значение числа минут периода для текущего графика. 
//=================================================
//******** Поиск опорных точек предложения ********
//=================================================
         for(i=2+StepBack,D=2,NP=0; (NP<D)&&(i<Bars); i++)           // Перебираем бары влево начиная со 2-го бара от текущего
             {                                                       // Begin
//            --- // ---
             }                                                       // End;
//=================================================
//********** Поиск опорных точек спроса ***********
//=================================================
         for(i=2+StepBack,D=2,NP=0; (NP<D)&&(i<Bars); i++)           // Перебираем бары влево начиная со 2-го бара от текущего 
             {                                                       // Begin
//            --- // ---
             }                                                       // End;
//=================================================
//****       Рисуем  TD-линии                  ****
//=================================================
//            --- // ---
         CurPeriod=Period();                                         // Соответствие минут графика с минутами системы
         nTime=Time[0];                                              // Соответствие время текущего и бара программы 
        }
//=================================================
//****     Формирование сигналов для сделок    ****
//=================================================
    Fun_New_Bar();                                                   // Определение нового бара
//=================================================
//****     Формирование сигналов на покупку    ****
//=================================================
    if((Close[i]>UpP[0]+UpV*(UpB[0]-i)+Puncture*Point) && (High[i+1]<=UpP[0]+UpV*(UpB[0]-(i+1)))) // Сигнал на покупку
        {
//            --- // ---                                                Нахождение баров для расчета проекторов
//            --- // ---                                                Расчет цен проекторов
//            --- // ---                                                Расчет размеров проекторов
         if(NoQw ... )                                               // Определение квалификаторов прорыва
             {
//            --- // ---                                                Формирование массива цен уровней целей
//            --- // ---                                                Создаем и рисуем сигнал на покупку кружок (красный)
              if(Flag_Up==true)
                  {
//            --- // ---                                                Создаем и рисуем линию на покупку (красный)
//            --- // ---                                                Создаем и рисуем линии целей
//================================================
//****         Открываем сделку  Buy          ****
//================================================
                   if(MiB_Up[1]==0 && Flag_Up_CD_Start==false && Flag_Up_Start==false && Flag_Dn_Start==false)
                       {
                        MiB_Up[1]=i;                                 // Массив номеров баров точек Up сделки MiB_Up[1]-левая, MiB_Up[0]-правая
                        MiP_Up[1]=Close[i];                          // Массив цен точек Up сделки MiP_Up[1]-левая, MiP_Up[0]-правая
                        MiBT_Up[1]=TimeCurrent();                    // Количество секунд в момент открытия сделки
                        Flag_Up_CD_Start=true;                       // Флаг рисования линий сделок на покупку - покупки запрещены    
                        Flag_Up_CD_End=false;                        // до закрытия сделки и образования нового бара
                        Flag_Dn_Start=true;                          // Запрещено открывать противоположную Dn сделку
//                      жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
                        AG_Message(Message, "АТ: сработал критерий открытия Buy.");                          // Сообщение(макс.62симв)                ж 
                        MN = AG_Magic_Number();                                                              // Вычисление MagicNumber (рекомендуется)ж 
                        OrderSend( Symbol(), OP_BUY, Lot, Ask, 2, Bid-SL*Point, Bid+TP*Point, Comm, MN);     // Открытие ордера Buy:                  ж
//                      жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
                       }                                   
                   bay++;                                            // Счетчик нарисованных линий целей на покупку
                   Flag_Up=false;                                    // Линии нарисовали - флаг опустили до образования нового бара
                  }
             }
        }
//=================================================
//****           Закрываем сделку  Buy         ****
//=================================================
    if(Flag_Up_CD_Start==true && Flag_Up_CD_End==false)              // Флаг конца рисования линий сделок на покупку - закрытие сделки       
        {                                                            // Пока сделка открыта, пересчитываем точку [0] и перерисовываем линию
//            --- // ---                                             // Расчет времени слелки (статистика отчета)
//            --- // ---                                             // Расчет результата слелки (статистика отчета)
//            --- // ---                                             // Рисуем линию сделки Up
//-------жжжжжжжжжжжжжжжжжжжжжжжжж Выбор условий закрытия слелки Up
         if(CD_TrSL && Close[i]<iP_Up-TrStopLoss*Point)              // (TrStopLoss==TrSL) Если цена пересекла TrStopLoss        
             {
//            жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
              if (NormalizeDouble(Order[1][6],0) == 0.0)             // Если тип ордера Buy                                                           ж
                  {                                                                                                                                   ж
               _Ord_Ticket = NormalizeDouble(Order[1][4],0);         // Номер ордера                                                                  ж
               _Ord_Lots = NormalizeDouble(Order[1][5],2);           // Полное закрытие                                                               ж
               OrderClose(_Ord_Ticket, _Ord_Lots, Bid, 2);           // Закрыть ордер Buy                                                             ж
                  }                                                                                                                                   ж
//            жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
//            --- // ---                                             // Расчет времени по всем Up сделкам (статистика отчета)
//            --- // ---                                             // Расчет времени по всем сделкам (статистика отчета)
//            --- // ---                                             // Расчет баланса и результатов Up сделок (статистика отчета)
//            --- // ---                                             // Формируем строку отчета (статистика отчета)
             }
         WindowRedraw();         
        }
//=================================================
//****     Формирование сигналов на продажу    ****
//=================================================
    if((Close[i]<DownP[0]+DownV*(DownB[0]-i)-Puncture*Point) && (Low[i+1]>=DownP[0]+DownV*(DownB[0]-(i+1)))) // Сигнал на продажу
        {
//            --- // ---                                                Нахождение баров для расчета проекторов
//            --- // ---                                                Расчет цен проекторов
//            --- // ---                                                Расчет размеров проекторов
         if(NoQw ... )                                               // Определение квалификаторов прорыва
             {
//            --- // ---                                                Формирование массива цен уровней целей
//            --- // ---                                                Создаем и рисуем сигнал на продажу кружок (синий)
              if(Flag_Dn==true)
                  {
//            --- // ---                                                Создаем и рисуем линию на продажу (синий)
//            --- // ---                                                Создаем и рисуем линии целей
//=================================================
//****       Открываем сделку Sell             ****
//=================================================
                   if(MiB_Dn[1]==0 && Flag_Dn_CD_Start==false && Flag_Dn_Start==false && Flag_Up_Start==false)
                       {
                        MiB_Dn[1]=i;                                 // Массив номеров баров точек Dn сделки iB_Up[1]-левая, iB_Dn[0]-правая
                        MiP_Dn[1]=Close[i];                          // Массив цен точек Dn сделки iP_Dn[1]-левая, iP_Dn[0]-правая
                        MiBT_Dn[1]=TimeCurrent();                    // Массив времени баров содержащих точки Dn сделки iBT_Dn[1]-левая, iBT_Dn[0]-правая
                        Flag_Dn_CD_Start=true;                       // Флаг начала рисования линий сделок на продажу                       
                        Flag_Dn_CD_End=false;                        // Флаг конца рисования линий сделок на продажу                       
                        Flag_Up_Start=true;                          // Запрещено открывать противоположную Up сделку
//                      жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
                        AG_Message(Message, "АТ: сработал критерий открытия Sell.");                         //Сообщение(макс62симв)                  ж
                        MN = AG_Magic_Number();                                                              // Вычисление MagicNumber (рекомендуется)ж
                        OrderSend( Symbol(), OP_SELL, Lot, Bid, 2, Ask+SL*Point, Ask-TP*Point, Comm, MN);    // Открытие ордера Sell:                 ж
//                      жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
                       }
                   sell++;                                           // Счетчик нарисованных линий целей на продажу
                   Flag_Dn=false;                                    // Линии нарисовали - флаг опустили до образования нового бара
                  }
             }
        }
//=================================================
//****           Закрываем сделку Sell         ****
//=================================================
    i=0;
    if(Flag_Dn_CD_Start==true && Flag_Dn_CD_End==false)              // Флаг конца рисования линий сделок на продажу - закрытие сделки      
        {                                                            // Пока сделка открыта, пересчитываем точку [0] и перерисовываем линию
//            --- // ---                                             // Расчет времени слелки (статистика отчета)
//            --- // ---                                             // Расчет результата слелки (статистика отчета)
//            --- // ---                                             // Рисуем линию сделки Dn
//            --- // ---
//-------жжжжжжжжжжжжжжжжжжжжжжжжж Выбор условий закрытия слелки Dn
         if(CD_TrSL && Close[i]>iP_Dn+TrStopLoss*Point)              // (TrStopLoss==TrSL) Если цена пересекла TrStopLoss        
             {
//            жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
              if (NormalizeDouble(Order[1][6],0) == 1.0)             // Если тип ордера Sell                                                          ж
                  {                                                                                                                                   ж
                   _Ord_Ticket = NormalizeDouble(Order[1][4],0);     // Номер ордера                                                                  ж
                   _Ord_Lots = NormalizeDouble(Order[1][5],2);       // Будем закр.ордер полностью                                                    ж
                   OrderClose(_Ord_Ticket, _Ord_Lots, Ask, 2);       // Закрыть ордер Sell                                                            ж
                  }                                                                                                                                   ж
//            жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
//            --- // ---                                             // Расчет времени по всем Dn сделкам (статистика отчета)
//            --- // ---                                             // Расчет времени по всем сделкам (статистика отчета)
//            --- // ---                                             // Расчет баланса и результатов Dn сделок (статистика отчета)
//            --- // ---                                             // Формируем строку отчета (статистика отчета)
             }
         WindowRedraw();         
        }
   }
//  жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
    return(1);           // Нормальный выход                                                                                      ж
   }                                                                                                                              ж
//  жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж
void Fun_New_Bar()                                                   // Функция определения образования нового бара
//            --- // ---


 
LeonidSB писал(а) >>

But exactly I made a strategy function code scheme (based on indicator algorithm) and I don't know where and how to insert script for ObjectsDeleteAll()? Did I put in the trading functions correctly (they are highlighted with "zzzzzzzz")? Please take a look at this stuff:

I think you're getting a lot ahead of yourself.

In programming, you can't operate by feel.

You must not use anything in your own code that a programmer doesn't quite understand or doesn't understand at all.

That way nothing gets done.

Programming, perhaps more than any other activity, in its essence requires complete clarity and full self-reporting.

Start by writing elementary code. Only move on to more complex ones when you have a full explanation of every letter in your code.

--

There are examples of simple and simple Expert Advisors in the textbook.

Earlier, in the introduction to programming, there is a classification of application programs (signs and differences between Expert Advisors, scripts and indicators).

A script cannot be "plugged" into an Expert Advisor. This is a separate independent programme.

At a glance, I can say that your code is poorly formatted.
Besides, most of the blocks could be designed as functions. That would be more clear (otherwise you won't be able to read your own code in a couple of months)

 

You are absolutely right. I agree with you on all points. Thank you for taking the time to provide constructive criticism!


By "include" I mean to write code linking the script operation to AG_AT() or its function, which implements the strategy.


In the tutorial, the example of a simple Expert Advisor contains start(), while in the regular one, all special functions are present. There are no problems, but as they say, "the appetite comes with the meal".

The question is how to use all the great featuresof AutoGraf-4. What should I do?

Reason: