OrderSelect Wrong Parameters Count - - New to MQL5 and do not know stuff

 
Hello, i hope you are having a good day, i am trying to create a programm for mt5 where if the order is at a certain profit the EA to set a sl at a certain position which equals to $ 
The code i have and it is not working : 
#include <Trade\Trade.mqh>
#define SELECT_BY_POS 0
#define MODE_TRADES 1

void OnTick()
{
   MqlTradeRequest request;
   MqlTradeResult result;
   ZeroMemory(request);
   ZeroMemory(result);

   for (int i = 0; i < OrdersTotal(); i++)
   {
      if (OrderSelect(i, SELECT_BY_POS))
      {
         if (OrderProfit() >= 50.0)
         {
            request.action = TRADE_ACTION_SLTP;
            request.symbol = OrderSymbol();
            request.ticket = OrderTicket();
            request.sl = OrderOpenPrice() - 20.0 * _Point;
            request.tp = OrderTakeProfit();

            if (OrderSend(request, result))
            {
               Print("Stop loss set for order ", OrderTicket());
            }
            else
            {
               Print("Failed to set stop loss for order ", OrderTicket(), " - Error: ", result.retcode);
            }
         }
      }
   }
}
It is giving me way to many errors : 
'OrderSelect' - wrong parameters count  AutoSL.mq5      45      11
'OrderProfit' - undeclared identifier   AutoSL.mq5      47      14
')' - expression expected       AutoSL.mq5      47      26
'OrderSymbol' - undeclared identifier   AutoSL.mq5      50      30
')' - expression expected       AutoSL.mq5      50      42
'ticket' - undeclared identifier        AutoSL.mq5      51      21
'OrderTicket' - undeclared identifier   AutoSL.mq5      51      30
')' - expression expected       AutoSL.mq5      51      42
'OrderOpenPrice' - undeclared identifier        AutoSL.mq5      52      26
')' - expression expected       AutoSL.mq5      52      41
'OrderTakeProfit' - undeclared identifier       AutoSL.mq5      53      26
')' - expression expected       AutoSL.mq5      53      42
'OrderTicket' - undeclared identifier   AutoSL.mq5      57      50
')' - expression expected       AutoSL.mq5      57      62
'OrderTicket' - undeclared identifier   AutoSL.mq5      61      60
')' - expression expected       AutoSL.mq5      61      72
Can someone give me an idea at least why at the () are errors and at the undecleared identifier

Thanks for the help
 
Taulant:
Hello, i hope you are having a good day, i am trying to create a programm for mt5 where if the order is at a certain profit the EA to set a sl at a certain position which equals to $ 
The code i have and it is not working : 
It is giving me way to many errors : 
Can someone give me an idea at least why at the () are errors and at the undecleared identifier

Thanks for the help

You are using MQL4 for an MQL5 program.

I suggest you look for the following equivalences here:

Articles

Migrating from MQL4 to MQL5

Sergey Pavlov, 2010.05.17 13:32

This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.

Edit: Obviously not all equivalences are there and certainly not the ones you are looking for. That may be because there is no equivalence as such, as there are things that from MQL4 to MQL5 are done slightly differently. In any case make sure you use the MQL5 language if you intend to code for MT5.

https://www.mql5.com/en/docs

MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
  • www.mql5.com
MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5