Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1386

 
Mik45 #:

Hello!

Can you tell me, I downloaded an indicator, it is in the indicators section in METEDITOR, but in the terminal, in the custom section it did not appear... What can I do?

You need to compile the code in MetaEditor.

 
Mik45 #:

Hello!

Can you tell me, I downloaded an indicator, it is in the indicators section in METEDITOR, but in the terminal, in the custom section it did not appear... What can I do?

If this is not an .ex but an .mq file, you have to compile it

 

Good day to all.

I am writing an EA using Elder's Three Screens system,

I need to prescribe the setting of short and long window

depending on the current one.

I can not realize it.

I tried it this way, but it does not work.

Files:
 

Good afternoon!

Please advise how to do. I need to download a page from my personal account from investing.com from MT5

I am able to use WebRequest function to download the page (not from my personal account).

My question is how to pass the authorization on the site? May be someone has done something like this? Or know an article about it?

 
Kot #:

Good afternoon!

Please advise how to do. I need to download a page from my personal account from investing.com from MT5

I am able to use WebRequest function to download the page (not from my personal account).

My question is how to pass the authorization on the site? May be someone has done something like this? Or know an article about it?

Just in case - be careful with the requests to investing. If you pull them too actively, they may be banned by IP.

 

Please advise:
We need to get a profit on a pending transaction - including past clearing.

Is it possible to do this with CDealInfo or CPositionInfo classes?

Design:

   CPositionInfo Trading_position; 

   if(Trading_position.Select(_Symbol) == true)     {

      double Profit = Trading_position.Profit(); }

Allowed to get only the current profit, without taking into account the profit received earlier.

 
qadexys #:

Please advise:
We need to get a profit on a pending transaction - including past clearing.

Is it possible to do this with CDealInfo or CPositionInfo classes?

Design:

Allowed to get only the current one, without taking into account the profit received earlier.

Example for netting (position selection by symbol name)

Forum on trading, automated trading systems and testing trading strategies

How to turn profit into profit points?

Vladimir Karputov, 2022.01.11 05:59

Like that:

//+------------------------------------------------------------------+
//|               Points profit of a position by trading history.mq5 |
//|                              Copyright © 2022, Vladimir Karputov |
//|                      https://www.mql5.com/en/users/barabashkakvn |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2022, Vladimir Karputov"
#property link      "https://www.mql5.com/en/users/barabashkakvn"
#property version   "1.003"
#property script_show_inputs
#include <Trade\PositionInfo.mqh>
CPositionInfo  m_position;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   if(m_position.Select(Symbol())) // select the position for further work
     {
      double profit=m_position.Profit();
      //--- request trade history
      if(!HistorySelectByPosition(m_position.Identifier()))
        {
         Print("Error HistorySelectByPosition");
         return;
        }
      //---
      uint history_deals_total=HistoryDealsTotal();
      double price_in=0.0;
      long time_in=TimeCurrent()+3600*24*3;
      //--- for all deals
      for(uint i=0; i<history_deals_total; i++)
        {
         ulong ticket=HistoryDealGetTicket(i);
         if(ticket)
           {
            profit+=HistoryDealGetDouble(ticket,DEAL_COMMISSION)+HistoryDealGetDouble(ticket,DEAL_SWAP)+HistoryDealGetDouble(ticket,DEAL_PROFIT);
            if(HistoryDealGetInteger(ticket,DEAL_ENTRY)==DEAL_ENTRY_IN)
              {
               long deal_time=HistoryDealGetInteger(ticket,DEAL_TIME);
               double deal_price=HistoryDealGetDouble(ticket,DEAL_PRICE);
               if(deal_time<time_in)
                 {
                  time_in=deal_time;
                  price_in=deal_price;
                 }
              }
           }
        }
      if(price_in>0.0)
        {
         double price_diff=MathAbs(m_position.PriceCurrent()-price_in);
         int points_profit=(int)(price_diff/Point());
         PrintFormat("position Ticket %d, position ID %d, profit %.2f, points profit %d: ",
                     m_position.Ticket(),m_position.Identifier(),profit,points_profit);
        }
     }
  }
//+------------------------------------------------------------------+


Result:

2022.01.11 06:57:32.678 Points profit of a position by trading history (XAUUSD,M15)     position Ticket 1235269798, position ID 1235269434, profit -0.63, points profit 71: 

 
Good evening!
This is a question, is it possible to write a telegram bot that will broadcast information about closed orders, etc. Like on the picture
 
Семён Метлицкий #:
Good evening!
This is a question, is it possible to write a telegram bot that will broadcast information about closed orders, etc. As on the picture

Yes, please send it here

 
Семён Метлицкий #:
Good evening!
This is a question, is it possible to write a telegram bot that will broadcast information about closed orders, etc. Like in the picture

"This way you will see how much the robot has bought orders from your deposit"...

This is tinny. A full deposit of sell orders.

Do people really fall for this?

Stop the Earth.

Just kidding.