Discussion of article "Timeseries in DoEasy library (part 58): Timeseries of indicator buffer data" - page 2

 
Alexander:

In TestDoEasyPart56 in the void OnInitDoEasy() function at the very end of the function, I have inserted this code so that

get a collection of historical orders from the date D'2020.12.11 10:00' to the current one. And I got none of them

order was not given by this code.

In the place where I Print(list_positions.Total()); I get "0".

OnInitDoEasy() is not intended to work inside it. You need this function to properly initialise the library. Work in OnTick
 
Artyom Trishkin:
OnInitDoEasy() is not intended to work inside it. This function is needed to properly initialise the library. Work in onTick

I inserted it into onTick() nothing changed:

//| Expert tick function|
//+------------------------------------------------------------------+
void OnTick()
  {
//--- NewTick event handling in the library
   engine.OnTick(rates_data);

//--- If working in the tester
   if(MQLInfoInteger(MQL_TESTER))
     {
      engine.OnTimer(rates_data);   // Timer operation
      engine.EventsHandling();      // Working with events
     }
   
//--- If the trailing flag is set
   if(trailing_on)
     {
      //TrailingPositions(); // Trailing Positions
     // TrailingOrders(); // Trailing pending orders
     }
     CArrayObj* list_positions=engine.GetListHistoryOrders();
           // list_positions=CSelect::ByOrderProperty(list_positions,ORDER_PROP_SYMBOL,Symbol(),EQUAL);
            list_positions=CSelect::ByOrderProperty(list_positions,ORDER_PROP_TIME_CLOSE,D'2020.12.10 10:00',MORE);
            //--- Select positions with profit greater than zero
            list_positions=CSelect::ByOrderProperty(list_positions,ORDER_PROP_PROFIT,0,MORE);
            if(list_positions!=NULL)
              {Print("OK1");
               //--- Sort the list by profit 
               //list_positions.Sort(SORT_BY_ORDER_PROFIT);
               list_positions.Total();
               Print(list_positions.Total());
               //--- Obtain the index of the position with the highest profit
               int index=CSelect::FindOrderMax(list_positions,ORDER_PROP_PROFIT);
               if(index>WRONG_VALUE)
                 {Print("index= ",index);
                  COrder* position=list_positions.At(index);
                  if(position!=NULL)
                    {
                     //--- Get the ticket of the position with the highest profit and close the position by the ticket
                     Print("OK");
                     Print(engine.GetListDeals());
                    }
                 }
              }
  }
 
Alexander:

Inserted it into onTick() nothing changed:

In each EA in the examples there is a code block for selecting and closing positions with the highest profit. You can do it by analogy. I can't even look at it - from my mobile.
 
Artyom Trishkin:

What's stopping you from writing in and picking up this medal yourself?

I have no claim. Let you have it. You deserve it ;)

 
Aleksey Mavrin:

I have no claim. Let you have it. You deserve it ;)

Thank you. I don't want it. We'll leave it to others.

 

It's a pity, but there is no strong side of MT5 programming community as mutual improvement of code and creation of help for public works. Those who write help, for example, always improve their understanding of the code.

Maybe it is for the best! I think I will still read all the articles from the DoEasy cycle. I've reached article 34, I'll tell you that it's still a witty coboeuvre)). Pohodu reading think that it's bad that there is no diagram of construction, this software art, but I think maybe for the best that you need to think a little.


Conclusions from the articles are very much, especially for amateur programmers, which most traders novadais. Thank you! I hope there will be more.

Как в MetaTrader 5 быстро разработать и отладить торговую стратегию
Как в MetaTrader 5 быстро разработать и отладить торговую стратегию
  • www.mql5.com
Скальперские автоматические системы по праву считаются вершиной алгоритмического трейдинга, но при этом они же являются и самыми сложными для написания кода. В этой статье мы покажем, как с помощью встроенных средств отладки и визуального тестирования строить стратегии, основанные на анализе поступающих тиков. Для выработки правил входа и...
 

Shit, why does everyone keep asking for this certificate? There is a help for SB, so what? I use it only if I forget the specific name of a method, a little faster than opening the class description).

In SB in timeseries there is a method that changes the buffer size. Without it the work with time series is limited, and there is no word about it in the help, about default values too.

So why such a flawed help if there is a code.

In any case, to start serious use you should go through the code, starting with interfaces and further on.

So don't distract Artyom with the help, let him do what he can).

 
Aleksey Mavrin:

Shit, why does everyone keep asking for this certificate? There is a help for SB, so what? I use it only if I forget the specific name of a method, a little faster than opening the class description).

In SB in timeseries there is a method that changes the buffer size. Without it the work with time series is limited, and there is no word about it in the help, and about default values too.

So why such a flawed help, if there is a code.

In any case, to start serious use you should go through the code, starting with interfaces and further on.

So don't distract Artyom with the help, let him do what he can do)

The work is still large and it is necessary to have a certificate and registration on gitHub.