Developers! Do you even test what you create? - page 6

 
Mikalas:

Could you please tell me how do you control if an order is modified (without server response)?

Modification of an order triggers several events and I control all these events and also control the time the pending task is in the pending list.

I have a forts robot making 500-600 trades per session and no loss of events so far, i.e. all tasks in the waiting list are executed and do not reach the timer check.

 
Yurich:

By definition, an event model cannot be completely reliable; if an event did not occur, it does not mean that it did not happen.

If some of the events reach and some don't, then duplicate blocks of code are needed to guarantee processing of command results, which would check the status by comparing it with the previous one, etc. Then the question is, if the duplicating code works absolutely reliably, why use code built on events? Why use two code instead of one which is not event driven? To breed redundancy?
 
Yurich:

Modifying an order triggers several events and I control all these events and I also control the time a waitlist task is on the waitlist.

My forts robot makes 500-600 trades per session and there have been no loss events so far, i.e. all tasks in the waiting list are executed and do not reach the timer check.

Now that's more interesting... So there hasn't been a loss of an expected event after all?
 
C-4:
Now that's more interesting... So there has never been a case where an expected event did not come?
When I said that there was no loss of events, I meant that tasks that were placed on the waiting list, waited for their event (at least one of the chain of significant events). Maybe there are losses of events that Michael says, I don't keep a log of the events, but they don't affect the overall functioning of my event model.
 

to:Michael.

In general, until the situation is resolved in some way, it is easier for you to do an additional check:

int dealsCount = 0;
///
/// С заданной периодичностью синхронизируем количество обработанных и поступивших трейдов.
///
void OnTimer(void)
{
   if(dealsCount != HistoryDealsTotal())
   {
      //Пришли новые трейды. их нужно обработать
      for(int i = dealsCount; i < HistoryDealsTotal(); i++)
      {
          ulong ticket = HistoryDealGetTicket(i);
          DealChecking(ticket);
      } 
   }
}

///
/// Поступило новое событие о поступлении трейда.
///
void  OnTradeTransaction(
      const MqlTradeTransaction&    trans,
      const MqlTradeRequest&        request,
      const MqlTradeResult&         result
   )
{
   if(trans.type == TRADE_TRANSACTION_DEAL_ADD)
     DealChecking(trans.deal);
   ...
}

///
/// Обработчик трейдов.
/// \param ticket - Уникальный идентификатор трейда, который надо обработать.
void DealChecking(int ticket)
{
   
   // Далее идет нужная обработка.
   ...
   //Трейд обработан - увеличиваем количество обработанных трейдов.
   dealsCount++;
}

There is no redundancy in this implementation because there is only one actual handler of the "new trade" event. But it is called in two different ways: via timer and via event OnTradeTransaction. If the new trade hasn't called the OnTradeTransaction event for some reason, an unsynchronization of the total amount and the amount of processed trades will occur. All unprocessed trades in this case will still get to the DealChecking handler via the for loop.

This scheme can be restricted for any event, not only for TRADE_TRANSACTION_DEAL_ADD.
 
Mikalas:

...

P/S And there is no need to 'tear out the text' and the whole sentence starts like this:

Knowing the type of trade, you can decide to analyse the current status of orders, positions and trades in your trading account.

You can always find more details in the Help.

I agree withYurich about everything else. You should probably reconsider your scheme as well.

 

Dear colleagues!

Thank you all very much for your opinions!

Only a worm gnaws at me: What is the PLATFORM for then?

 

Mikalas:

Why do you need a PLATFORM then?

That was probably a rhetorical question :) If not, the answer has already been given in this thread:

Forum on trading, automated trading systems and testing of trading strategies

Developers! Do you even test what you create?

C-4, 2013.12.10 12:08

I don't recommend it. It's much easier to fix this bug together with MQ than to build a new terminal for the plaza on your own. You'll get bogged down in endless bug fixes and writing "standard functionality". I'm speaking from my own experience. I partially developed one of such self-made complexes based on Stock# - the result is another "bicycle" for specific tasks. You'd better fight with the support service, it will be easier and cheaper.
I'm not happy with everything in the terminal either, e.g. the "last price" attitude. But I hope that when a critical mass of stockbrokers gathers, MQ will start listening to their needs.
 
ok. what is the real alternative to MT5?
 
Armen:
ok. what is the real alternative to MT5?

This is exactly the question you need to ask yourself before creating such threads. Before the arrival of MT5, to trade on FORTS, you had to at least write your own trading terminal. If there is no ready-made solutions in this area, apart from Quick that is hardly applicable for algorithmic trading (those who once wrote a program more than 1000 lines long on QPile will understand what I'm talking about). There is an auxiliary set of Stock# libraries, but it has not developed into a full-fledged trading terminal "out of the box" (run and trade). Actually it will take up to 6 months for a programmer of average or high skill to create a trading platform using Stock#. The beginner programmer will be overpowered by this product. There are also terminals like Kofite, TSLab, WealthLab. But you have to clearly understand that they are not directly supported by the brokers, so you have to deal with Quick + your Super Trading Platform (with all the associated problems of data transfer through DDE). And if you want to work through the protocol PlazaII - for 3 000 rubles per month, the broker will provide you with such an opportunity.

In the bourgeois segment, things are not better. Not every American broker provides a trading platform with the possibility of algotrading. Not every American broker is possible to work with from Russia. It is good if they give you an API. And again we are back to writing our own bicycle for this API. Not only that, but the platforms provided are far too different, geared for different market segments. Just compare Wealth-Lab with ThinkOrSwim. No standards, no unified interface.

In general, if your motto is "I only dream about peace" or "I trade to test new software and write the next bicycle" - then you really should look for some other platform than MetaTrader5.