MT5 Closed Positions History

Hello, i have the following simple MT4 code to show some infos from closed trades.

      for(i=0; i<=OrdersHistoryTotal(); i++)
  {
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
      {
       if(OrderCloseTime()>0 && OrderTicket()>0)
       {
        Print(OrderTicket(),"  ",OrderSymbol(),"  ",OrderProfit());
       }
      }
  }

Hoe can help me with a simple example which show the same infos in MT5 hedging account?
I hate how metquotes have make this MT5 complicate with deals and orders bla bla bla i just want to have the f… closed trades which seems to be called positions.

If possible give me a example without OOP Style, i want to understand the example and learn something from it also lot of other people will be happy to see a clean example without OOP and libaries.

The script below is what you need. Download the MT4Orders-library and write in the MT4-style on the MT5.

#include <MT4Orders.mqh> // https://www.mql5.com/ru/code/16006

void OnStart()
{
  for(int i=0; i<=OrdersHistoryTotal(); i++)
  {
    if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true)
      {
       if(OrderCloseTime()>0 && OrderTicket()>0)
       {
        Print(OrderTicket(),"  ",OrderSymbol(),"  ",OrderProfit());
       }
      }
  }  
}