FORTS: Inefficient Transaction Fee - page 2

 
Sergey Chalyshev:

Of course, an official explanation wouldn't hurt.

What is missing for full satisfaction is a tap function like this:

 AccountInfoInteger(ACCOUNT_TRANSACTION_SESSION) // - количество транзакций за текущую сессию.

If an exchange keeps count of the number of transactions, it's probably possible to get this data into the terminal.

We must ask MQ developers to add such a feature.

Yes, it would be good.

I myself count...

 
Михаил:

Yes, that would be good.

I myself consider...

Wrote a proposal to the SR.
 

The answer has arrived!

Верно, объем заявки, сделки - не важен.

 С уважением,
Глеб Кочнев
Техническая поддержка ПАО Московская Биржа
+7 (495) 733-95-07 | help@moex.com

 
 
--- Первоначальное сообщение ---
С: 
Отправленные: 25.11.2015 0:16:09
По: help@moex.com
Копия: 
Тема: Re[2]: Сбор за неэффективные Транзакции (N602821N)
 

Добрый день, Глеб!

Осталось выяснить следующий ньюанс.

Из формулы по расчёту неэффективных транзакций
не ясен параметр "l"
l – балл для Сделки, заключенной с указанием одного из Разделов (определенный по типу Сделки в соответствии с Таблицей 1).
Имеется ввиду, что формула не учитывает объём сделки?
Т.е 1 сделка - 40 баллов и неважно каким объёмом она была совершена?

Михаил

There, now it's all clear. You can count.

#property copyright "Copyright 2015, Mikalas"
#property link      "https://www.mql5.com"
#property version   "1.00"
//
input double  TrPoint    = 1;    //Балл за транзакцию
input ulong   DealPoint  = 40;   //Балл за сделку
input ulong   SesTrCount = 620;  //Транзакций за сессию 
//
double ord_count, trans_count;
//
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
  ord_count = NormalizeDouble( double( SesTrCount ) * TrPoint, 0 );
  SetTransactions();
  return( INIT_SUCCEEDED ); 
}
//+------------------------------------------------------------------+
//| Expert Set start day time function                               |
//+------------------------------------------------------------------+
datetime SetStDayTime()
{
  MqlDateTime  dt_str; 
  TimeTradeServer( dt_str );
//---
  if ( ( dt_str.day_of_week == 0 ) || ( dt_str.day_of_week == 6 ) ) return( datetime( 0 ) );  
//---
  string time_str = IntegerToString( dt_str.year ) + "." + IntegerToString( dt_str.mon ) +
                    "." + IntegerToString( dt_str.day ) + " 19:00:00";
  ulong cur_day = ulong( StringToTime( time_str ) );                     

  if ( ( dt_str.hour >= 19 ) && ( dt_str.hour <= 23 ) )
  {
    return( StringToTime( time_str ) );
  }
  else
  {
    ulong one_day = 24 * 60 * 60;
//---      
    if ( dt_str.day_of_week == 1 )
    {
      cur_day -= one_day * 3;
    }
    else
    {
      cur_day -= one_day;
    }
    return( datetime( cur_day ) );
  }  
  return( datetime( 0 ) );
}
//+------------------------------------------------------------------+
//| Expert calc deals fee function                                   |
//+------------------------------------------------------------------+
double GetExgangeFee( const datetime start_time )
{
  double all_fee = 0.0;
  ulong deal_ticket;
//---  
  if ( HistorySelect( start_time, TimeTradeServer() ) )
  {
    int deals_total = HistoryDealsTotal();
//---   
    if ( deals_total > 0 )
    {
      for ( uint i = 0; i < uint( deals_total ); i++ )
      {
        deal_ticket = HistoryDealGetTicket( i );
//---        
        if ( deal_ticket > 0 )
        {
          ulong order_ticket = ulong( HistoryDealGetInteger( deal_ticket, DEAL_ORDER ) );
          
          if ( order_ticket > 0 )
          {
            all_fee += HistoryDealGetDouble( deal_ticket, DEAL_COMMISSION );
          }  
        }
      }
      return( MathAbs( all_fee ) );
    }  
  }
  return( 0 );
}
//+------------------------------------------------------------------+
// Expert Set transactions function                                  |
//+------------------------------------------------------------------+
void SetTransactions()
{
  datetime start_time = SetStDayTime();
  double tr_bonus = GetExgangeFee( start_time );
//---
  if ( tr_bonus > 0.0 )
  {
    double bonus = tr_bonus * double( DealPoint ); 
    ord_count = NormalizeDouble( double( SesTrCount ) * TrPoint + bonus, 0 );
  }   
}
//Осталось "организовать" счётчик транзакций ( trans_count )
//и при установке, удалении или модификации ордера, считать кол-во транзакций.
//А во время клиринга обнулять счётчик транзакций.
//Перед установкой ордера проверять

/*if ( trans_count < ord_count )
{
  //Установка ордера
}*/
//Функцию SetTransactions() вызывать после каждой сделки и при инициализации
 

Slightly reworked in my own way, the function to get the start time of the session:

//+------------------------------------------------------------------+
//| Get start session time function Serj                             |
//+------------------------------------------------------------------+
datetime GetTimeStartSession()
  {
   MqlDateTime  dt_str;
   datetime one_day=86400;
   TimeTradeServer(dt_str);
   int hour=dt_str.hour;
   dt_str.hour=19; dt_str.min=0; dt_str.sec=0;
   datetime time_start=StructToTime(dt_str);
   
   switch(dt_str.day_of_week)
     {
      case 6: time_start-=one_day; break;
      case 0: time_start-=(one_day*2); break;
      case 1: if(hour<19) time_start-=(one_day*3); break;
      default: if(hour<19) time_start-=one_day; break;
     }
   return(time_start);
  }
//+------------------------------------------------------------------+

works six times faster.

2015.11.27 08:20:52.374 Speed Test Time Session (UTRY-12.15,H1) session start time: 2015.11.26 19:00:00
2015.11.27 08:20:52.374 Speed Test Time Session (UTRY-12.15,H1) Serj Время выполнения = 89 mcs
2015.11.27 08:20:52.374 Speed Test Time Session (UTRY-12.15,H1) session start time: 2015.11.26 19:00:00
2015.11.27 08:20:52.374 Speed Test Time Session (UTRY-12.15,H1) Mikalas Время выполнения = 563 mcs

if you like it, you can move it to your newbie thread.

script to test:

 
Sergey Chalyshev:

Slightly reworked in my own way, the function to get the start time of the session:

works six times faster.

if you like it, you can move it to your newbie thread.

script to test:

I like it, thanks, it's really faster.
 
Михаил:

Today I received a "chain letter" for 208.10 roubles.

There have been 2,121 transactions.

At the same time, bought/sold during this trading day:

Exchange commission was: 30 rubles.

Point per transaction = 40

From above formulas we have:

Transactions = 2121 - (30 * 40) - 2000 = -1079

I "lacked" 1079 transactions for the penalty.

Fool our brother exchange just limit 2000 transactions, and then "out of the light" puts the penalty

(of course, maybe the broker steals it).

You must have made a mistake somewhere in your calculations.

But without your trading history and detailed logs it is impossible to check.

 
Andrey Khatimlianskii:

It is likely that you got your calculations wrong somewhere.

But without your trading history and detailed logs it is impossible to check.

You think I'm not able to calculate the number of transactions from the terminal logs?

P/S I sent everything to the technical support of the exchange.

Добрый день, Глеб!

01.12.2015 г. я получил от Вас (Биржи) штраф за
неэффективные транзакции. За данный торговый день (с 19:00 27.12.2015 по 18:45 30.12.2015),
я произвёл 2121 транзакцию, при этом было куплено/продано 5 MIX-12.15 и 50 MXI-12.15

1. На каком основании выставлен штраф в 208,10 руб, если я, исходя из формул биржи,
"недобрал" 1079 транзакций до штрафа?

2. Если не сложно, покажите на моём конкретном примере, как Вы (Биржа) насчитали 208,10 руб.

Во вложенном файле логи моего терминала с произведёнными транзакциями.


Михаил

I will publish the answer.

 
Михаил:

You think I am not able to calculate the number of transactions from the terminal logs?

P/S I sent everything to the technical support of the exchange.

I think you are human too and can be wrong. Isn't it so? )

We'll wait for a reply, I wonder what they say.

 
Andrey Khatimlianskii:

It is likely that you got your calculations wrong somewhere.

But without your trading history and detailed logs it is impossible to verify this.

Yes, I made a mistake.

The exchange used to issue a penalty the next day, but now, on the same day.

I took the wrong trading day :(

And the number of transactions (today) was 2081, which resulted in a penalty of 208.10 rubles.

This is correct.

 
Михаил:

Yes, my mistake.

The exchange used to issue a penalty the next day, but now, on the same day.

I took the wrong trading day :(

And the number of transactions (today) was 2081, which resulted in a penalty of 208.10 rubles.

This is correct.

It still does not "fit" into your formula.
Reason: