Machine learning in trading: theory, models, practice and algo-trading - page 3240

 
Question for developers, are ONNX models in MT run on the processor or the video card?
 

Another important question is whether the model will get information about the trading environment - what positions are open, what is there in the history....

 
Rorschach #:
Question to developers, ONNX models in MT are executed on processor or video card?
On the CPU using AVX/AVX2/AVX512 instructions in any terminal or tester build. This is an executive system that runs small and fast.

And ONNX works without problems in Linux and Macs as well. No additional support systems are required.

GPUs are critical just at the stage of training.
 
Aleksey Vyazmikin #:

Another important question is whether the model will receive information about the trading environment - what positions are open, what is there in the history.....

The testing system will consist of three components:
1) our single robot template
2) your wrapper model.mq5 in source code to provide input/output of data to ONNX model, interpretation of results and generation of trades
3) model.onnx - your neural model
 
There is a huge amount of information on ONNX on our website.

Please use the search engine.
 

Renat Fatkhullin #:

GPUs are critical precisely at the learning stage.

ONNX could be an alternative for OpenCL. But this is just an idea for now.

 
Renat Fatkhullin #:
1) our single robot template

Up for discussion is the robot template for Tester.

// Торговый сигнал.
double SignalONNX( const MqlTick &Tick ) { return(0); }

#define  MT4ORDERS_AUTO_VALIDATION // Торговые приказы отправляются только в случае успешной проверки на корректность
#include <MT4Orders.mqh> // https://www.mql5.com/ru/code/16006

void OnTick()
{
  MqlTick Tick;
  
  if (SymbolInfoTick(_Symbol, Tick))
  {
    const double Signal = SignalONNX(Tick);        
    const int Type = (MathAbs(Signal) < 1) ? -1 : (Signal < 0);
    
    if (Type != -1)
    {
      int Count = 0;

      for (uint i = OrdersTotal(); (bool)i--;)
        if (OrderSelect(i, SELECT_BY_POS))
        {
          if (OrderType() == Type)
            Count++;
          else
            OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 0);
        }
        
      if (!Count)
        OrderSend(_Symbol, Type, 1, Type ? Tick.bid : Tick.ask, 0, 0, 0);
    }
  }
}

The code is concise, so it's immediately readable. It has three states: buy, sell, do nothing.

I don't see the point in complicating it, adding MM, etc. Then with MO you have to try harder.


The element of randomness is eliminated if you require that the frequency of transactions (one per day, for example) corresponds to the previous values. In general, we can discuss something at the code level.

 
Renat Fatkhullin #:
There is a huge amount of information on ONNX on our website.

Please use the search engine.

Will zipmap support be added? Not all models have it disabled when converting.

convenience for

ONNX: output parameter has unsuppotred type 'ONNX_TYPE_SEQUENCE'

Now if they go there, almost everyone will hit it, but they will not have the desire and ability to edit ONNX files.
 
Renat Fatkhullin #:
The testing system will consist of three components:
1) our single robot template
2) your model.mq5 wrapper in source code to provide data input/output to the ONNX model, interpretation of results and trade generation
3) model.onnx - your neural model

Thanks, this is already better!

Will the trading class be standard or can I use my own, with a more convenient wrapper?

 
mytarmailS #:

That's if you mean just the neural network model, not just any model like Forest.

Although hgboost is probably okay too.

---------------------------------

And it says that you can't convert any model, the model itself must support this format.

--------------------------------

So, the conclusion is that ONNH is python, no way out.

There is a list of model preparations recommended for use. All 3 boosts support both saving in c++ or json and onnx. Any others are impractical to use. With neural networks it's probably more complicated, maybe only in python.

Any preprocessing, at the level of execution of an already trained model, is usually quite simple and can be rewritten to another language.