What is the rollover fonction on MT4

 

Hello everyone,


It is the fisrt time I post a message.


I don't solve a issue and i need some help... I'm not able to find on MetaTrader4 how to find what is the rollover fonction ?


I'm able to find Swap with this function concerning directly the order

double  OrderSwap();


But with FXCM, they apply Rollover (instead swap). The rollover is applied on the balance (not on the order), as you can see in the attached file.


For one order opened, everyday one rollover is applied.

My goal is to get the information what is the total rollover applied for each order still opened.


Can you think you can help me ?


Thanks a lot !


Pascal

Files:
Rollover.PNG  54 kb
 

Total Profit is OrderProfit() + OrderSwap() + OrderCommission(). Some brokers don't use the Commission/Swap fields. Instead, they add balance entries. (Maybe related to Government required accounting/tax laws.)
          "balance" orders in account history - Day Trading Techniques - MQL4 programming forum (2017)

Broker History
FXCM
Commission - <TICKET>
Rollover - <TICKET>

>R/O - 1,000 EUR/USD @0.52

#<ticket>  N/A
OANDA
Balance update
Financing (Swap: One entry for all open orders.)
 

Think you William !


But i still not know how to get the rollover amount (for en expert advisor)...


The first difficulty (for me) is to find the order...

First I use :

  OrderSelect(i-1,SELECT_BY_POS,MODE_HISTORY)


After i use OrderType() and OrderSymbol() to filter to the order i'm looking for

But the type of OrderType are only the following ones :

OP_BUY - buy order,
OP_SELL - sell order,
OP_BUYLIMIT - buy limit pending order,
OP_BUYSTOP - buy stop pending order,
OP_SELLLIMIT - sell limit pending order,
OP_SELLSTOP - sell stop pending order.

No type such as Deposit or Withdrawal on the account balance...

So i'm not not able to find the order with the Rollover comment...


How to find the history order (such as deposit or withdrawal on the account balance) in witch thr rollover comment is set ?



Hereunder an exemple of function i use who count the number of order of the symbol of one type :

(

OrderType


//+------------------------------------------------------------------+

//| Orders Total for Symbol function                                 |

//+------------------------------------------------------------------+

int OrdersHistoryTotalSymbol(const int  OrdersType,

                             const bool Verbose)

  {


   int Nb = 0;

   const bool Debug = False;


   for(int i=1;i<=OrdersHistoryTotal();i++)

     {

      if(OrderSelect(i-1,SELECT_BY_POS,MODE_HISTORY)==True)

        {

         if(OrderSymbol() == _Symbol && OrderType()== OrdersType)

            {

             Nb++;

             if(Debug) Print("///",_Symbol,"/// ",__FUNCTION__,"(Type=",OrdersType,") => Nb=",Nb," ; i=",i," ; OrdersHistoryTotal=",OrdersHistoryTotal());

            }

        }

      else

         Print("///",_Symbol,"/// ",__FUNCTION__,"(Type=",OrdersType,") => OrderSelect for MODE_TRADES returned the error of ",GetLastError());

     }


   if(Verbose) Print("///",_Symbol,"/// ",__FUNCTION__,"(Type=",OrdersType,") => Nb=",Nb," ; OrdersHistoryTotal=",OrdersHistoryTotal());

   return(Nb);


//---

  }

 
  1. Please edit your post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

  2. Do not assume history has only closed orders.
              OrderType() == 6, 7 in the history pool? - MQL4 programming forum (2017)

  3. Do not assume history is ordered by date, it's not.
              Could EA Really Live By Order_History Alone? (ubzen) - MQL4 programming forum (2012)
              Taking the last profit and storing it in a variable | MQL4 - MQL4 programming forum #3 (2020.06.08)

 

Hello Willian,


With some delay for my return, thank you for your answer !

I will try for undocumented type of OrderType()

6 --> is balance

7 --> is credit

8 --> is rebate


Thanks a lot


Pascal