트레이딩의 머신러닝: 이론, 모델, 실전 및 알고리즘 트레이딩 - 페이지 900

 
알렉산더 이바노프 :

아니, 성배는 이미 준비되었습니까? AI))

음 fse ... 당신은 이미 과두 정치입니다))

kanesh, Maksimko는 항상 목표에 도달합니다

 
막심 드미트리예프스키 :

kanesh, Maksimko는 항상 목표에 도달합니다

)))

FSE... 모든 로봇을 버리고 멋진 지능형 로봇에 줄을 서십시오.

 
알렉산더 이바노프 :

)))

FSE... 모든 로봇을 버리고 멋진 지능형 로봇에 줄을 서십시오.

나는 이미 준군사적 경비원과 함께 스위스 벙커에 반쯤 갔고, 먼지투성이 자루를 지폐로 가득 채운 알렉산더를 따라갔지만, 대담하게 기억나지 않습니다!

 
막심 드미트리예프스키 :

다른 지점의 Alexander_K2

이상적으로는 mt5를 python과 연결하는 것이 가능하므로 시각화하고 즉시 확인할 수 있습니다. 이제 winapi를 통해 python 셸을 직접 호출하고 봇에서 python으로 명령을 보낼 가능성을 고려하고 있습니다. xs입니다. 가능한. 나는 R과 dll을 소화하지 못하며, 파이썬이 필요하지 않지만(기존의 기사와 작품을 보며) 그것들을 어떻게 사용하고 작업하고 싶지도 않다. 야생으로의 등반 욕구 감소 - 500,000 패키지 및 배기 가스는 2 MA의 봇에서와 동일합니다.

그러한 괴물과 연합하는 것은 많은 사람들에게 유용할 것이지만 많은 사람들에게는 그렇지 않습니다.

그리고 MA에 관해서는 그냥 잠이 들면서 16 단계로 10 질량을 취하고 예측 변수를 만들면 어떻게 될까요? - 각각에 대해 - 가격이 MA 위 / 아래에 열리고 하나 더 - 모든 번호를 매길 때 차트 상단에서 하단으로 MA, 여기 이러한 모델이 시장을 설명할 수 있습니까?

 
막심 드미트리예프스키 :

전체 모델을 드롭아웃(총 10개 모델 제공)하여 소규모 실험을 진행했습니다. 2018.04.01부터 앞으로

탈락 없이:

또한 숫자는 남은 무작위 모델의 수를 나타내며 나머지는 삭제되었습니다.

글쎄, 그런 일이 발생합니다. 아마도 매우 공개하지 않을 것입니다. 모델과 방울없이 아주 좋은 것으로 판명되었습니다. 그리고 모델이 서로 너무 비슷해서 좋지 않습니다. 학습 알고리즘을 수정해야 합니다(도움이 되는 게임 이론). 그러나 여전히 선택의 유연성이 나타났습니다.

좋아 보인다! 하나(1개 모델)에서 정지합니다.

 
알렉세이 비아즈미킨 :

그러한 괴물과 연합하는 것은 많은 사람들에게 유용할 것이지만 많은 사람들에게는 그렇지 않습니다.

그리고 MA에 관해서는 그냥 잠이 들면서 16 단계로 10 질량을 취하고 예측 변수를 만들면 어떻게 될까요? - 각각에 대해 - 가격이 MA 위 / 아래에 열리고 하나 더 - 모든 번호를 매길 때 차트 상단에서 하단으로 MA, 여기 이러한 모델이 시장을 설명할 수 있습니까?

그래서 질문을 할 수 없습니다. 실험, 실험... 왜냐하면 이론상 명백한 것은 없기 때문입니다. 6개월 동안 수백 가지의 다양한 차량을 시험해 보았습니다.

브랜치의 역사는 그것을 하지 않는 방법(때로는 하는 방법)에 대한 많은 정보를 저장합니다.   꽤 도움이됩니다.

 
알렉세이 비아즈미킨 :

그러한 괴물과 연합하는 것은 많은 사람들에게 유용할 것이지만 많은 사람들에게는 그렇지 않습니다.

그리고 MA에 관해서는 그냥 잠이 들면서 16 단계로 10 질량을 취하고 예측 변수를 만들면 어떻게 될까요? - 각각에 대해 - 가격이 MA 위 / 아래에 열리고 하나 더 - 모든 번호를 매길 때 차트 상단에서 하단으로 MA, 여기 이러한 모델이 시장을 설명할 수 있습니까?

약 10년 전쯤에 2에서 100까지 MA를 가지고 이런 실험을 한 기사가 있었습니다.
 
도서관 :
약 10년 전쯤에 2에서 100까지 MA를 가지고 이런 실험을 한 기사가 있었습니다.

그리고 팬이라고 하는거 같은데 틀리지않으면...

 

다른 언어와의 mql4 통신의 모든 문제가 해결되고 있는 것 같습니다. R에 대한 코드도 있습니다. 다음은 다이어그램입니다.



세 부분으로 된 모든 설명:

https://blog.darwinex.com/zeromq-interface-python-r-metatrader4/

https://blog.darwinex.com/zeromq-trade-execution-metatrader-zmq2/

https://blog.darwinex.com/zeromq-transaction-reporting-metatrader-zmq3/

승인됨:

왜 ZeroMQ인가?

하나.       프로그래머가 다양한 방법으로 모든 코드를 다른 코드에 연결할 수 있습니다.

2.       제거   메타 트레이더   MetaTrader가 지원하는 기술(기능, 지표, 언어 구성, 라이브러리 등)에 대한 사용자의 의존도

삼.       거래자는 C/C#/C++, Python, R 및 Java(몇 가지 예)로 지표와 전략을 개발하고 MetaTrader 4를 통해 시장에 배포할 수 있습니다.

4.       영향력   기계 학습   복잡한 데이터 분석 및 전략 개발을 위한 Python 및 R의 툴킷과 거래 실행 및 관리를 위한 MetaTrader 4와의 인터페이스.

5.       ZeroMQ는 MQL에서 구현하기 어려운 정교한 분산 거래 시스템에서 고성능 전송 계층으로 사용할 수 있습니다.

6.       필요한 경우 다양한 전략 구성 요소를 다양한 언어로 구축할 수 있으며 TCP, 프로세스 내, 프로세스 간 또는 멀티캐스트 프로토콜을 통해 서로 원활하게 대화할 수 있습니다.

7.       다중 통신 패턴 및 연결이 끊긴 작업.

그리고 여기 코드 가 있습니다

/+------------------------------------------------------------------+
//|                                       ZeroMQ_MT4_EA_Template.mq4 |
//|                                    Copyright 2017, Darwinex Labs |
//|                                        https://www.darwinex.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, Darwinex Labs."
#property link        "https://www.darwinex.com/"
#property version    "1.00"
#property strict

// Required: MQL-ZMQ from https://github.com/dingmaotu/mql-zmq
#include <Zmq/Zmq.mqh>

extern string PROJECT_NAME = "DWX_ZeroMQ_Example" ;
extern string ZEROMQ_PROTOCOL = "tcp" ;
extern string HOSTNAME = "*" ;
extern int REP_PORT = 5555 ;
extern int PUSH_PORT = 5556 ;
extern int MILLISECOND_TIMER = 1 ;   // 1 millisecond

extern string t0 = "--- Trading Parameters ---" ;
extern int MagicNumber = 123456 ;
extern int MaximumOrders = 1 ;
extern double MaximumLotSize = 0.01 ;

// CREATE ZeroMQ Context
Context context(PROJECT_NAME);

// CREATE ZMQ_REP SOCKET
Socket repSocket(context,ZMQ_REP);

// CREATE ZMQ_PUSH SOCKET
Socket pushSocket(context,ZMQ_PUSH);

// VARIABLES FOR LATER
uchar data[];
ZmqMsg request;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
//---

   EventSetMillisecondTimer (MILLISECOND_TIMER);     // Set Millisecond Timer to get client socket input
   
   Print ( "[REP] Binding MT4 Server to Socket on Port " + REP_PORT + ".." );   
   Print ( "[PUSH] Binding MT4 Server to Socket on Port " + PUSH_PORT + ".." );
   
   repSocket.bind( StringFormat ( "%s://%s:%d" , ZEROMQ_PROTOCOL, HOSTNAME, REP_PORT));
   pushSocket.bind( StringFormat ( "%s://%s:%d" , ZEROMQ_PROTOCOL, HOSTNAME, PUSH_PORT));
   
   /*
       Maximum amount of time in milliseconds that the thread will try to send messages 
       after its socket has been closed (the default value of -1 means to linger forever):
   */
   
   repSocket.setLinger( 1000 );   // 1000 milliseconds
   
   /* 
      If we initiate socket.send() without having a corresponding socket draining the queue, 
      we'll eat up memory as the socket just keeps enqueueing messages.
      
      So how many messages do we want ZeroMQ to buffer in RAM before blocking the socket?
   */
   
   repSocket.setSendHighWaterMark( 5 );     // 5 messages only.
   
//---
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
{
//---
   Print ( "[REP] Unbinding MT4 Server from Socket on Port " + REP_PORT + ".." );
   repSocket.unbind( StringFormat ( "%s://%s:%d" , ZEROMQ_PROTOCOL, HOSTNAME, REP_PORT));
   
   Print ( "[PUSH] Unbinding MT4 Server from Socket on Port " + PUSH_PORT + ".." );
   pushSocket.unbind( StringFormat ( "%s://%s:%d" , ZEROMQ_PROTOCOL, HOSTNAME, PUSH_PORT));
   
}
//+------------------------------------------------------------------+
//| Expert timer function                                            |
//+------------------------------------------------------------------+
void OnTimer ()
{
//---

   /*
      For this example, we need:
      1) socket.recv(request,true)
      2) MessageHandler() to process the request
      3) socket.send(reply)
   */
   
   // Get client's response, but don't wait.
   repSocket.recv(request, true );
   
   // MessageHandler() should go here.   
   ZmqMsg reply = MessageHandler(request);
   
   // socket.send(reply) should go here.
   repSocket.send(reply);
}
//+------------------------------------------------------------------+

ZmqMsg MessageHandler(ZmqMsg &request) {
   
   // Output object
   ZmqMsg reply;
   
   // Message components for later.
   string components[];
   
   if (request.size() > 0 ) {
   
       // Get data from request   
       ArrayResize (data, request.size());
      request.getData(data);
       string dataStr = CharArrayToString (data);
      
       // Process data
      ParseZmqMessage(dataStr, components);
      
       // Interpret data
      InterpretZmqMessage(&pushSocket, components);
      
       // Construct response
      ZmqMsg ret( StringFormat ( "[SERVER] Processing: %s" , dataStr));
      reply = ret;
      
   }
   else {
       // NO DATA RECEIVED
   }
   
   return (reply);
}

// Interpret Zmq Message and perform actions
void InterpretZmqMessage(Socket &pSocket, string & compArray[]) {

   Print ( "ZMQ: Interpreting Message.." );
   
   // Message Structures:
   
   // 1) Trading
   // TRADE|ACTION|TYPE|SYMBOL|PRICE|SL|TP|COMMENT|TICKET
   // e.g. TRADE|OPEN|1|EURUSD|0|50|50|R-to-MetaTrader4|12345678
   
   // The 12345678 at the end is the ticket ID, for MODIFY and CLOSE.
   
   // 2) Data Requests
   
   // 2.1) RATES|SYMBOL   -> Returns Current Bid/Ask
   
   // 2.2) DATA|SYMBOL|TIMEFRAME|START_DATETIME|END_DATETIME
   
   // NOTE: datetime has format: D'2015.01.01 00:00'
   
   /*
      compArray[0] = TRADE or RATES
      If RATES -> compArray[1] = Symbol
      
      If TRADE ->
         compArray[0] = TRADE
         compArray[1] = ACTION (e.g. OPEN, MODIFY, CLOSE)
         compArray[2] = TYPE (e.g. OP_BUY, OP_SELL, etc - only used when ACTION=OPEN)
         
         // ORDER TYPES: 
         // https://docs.mql4.com/constants/tradingconstants/orderproperties
         
         // OP_BUY = 0
         // OP_SELL = 1
         // OP_BUYLIMIT = 2
         // OP_SELLLIMIT = 3
         // OP_BUYSTOP = 4
         // OP_SELLSTOP = 5
         
         compArray[3] = Symbol (e.g. EURUSD, etc.)
         compArray[4] = Open/Close Price (ignored if ACTION = MODIFY)
         compArray[5] = SL
         compArray[6] = TP
         compArray[7] = Trade Comment
   */
   
   int switch_action = 0 ;
   
   if (compArray[ 0 ] == "TRADE" && compArray[ 1 ] == "OPEN" )
      switch_action = 1 ;
   if (compArray[ 0 ] == "RATES" )
      switch_action = 2 ;
   if (compArray[ 0 ] == "TRADE" && compArray[ 1 ] == "CLOSE" )
      switch_action = 3 ;
   if (compArray[ 0 ] == "DATA" )
      switch_action = 4 ;
   
   string ret = "" ;
   int ticket = - 1 ;
   bool ans = FALSE ;
   double price_array[];
   ArraySetAsSeries (price_array, true );
   
   int price_count = 0 ;
   
   switch (switch_action) 
   {
       case 1 : 
         InformPullClient(pSocket, "OPEN TRADE Instruction Received" );
         // IMPLEMENT OPEN TRADE LOGIC HERE
         break ;
       case 2 : 
         ret = "N/A" ; 
         if ( ArraySize (compArray) > 1 ) 
            ret = GetBidAsk(compArray[ 1 ]); 
            
         InformPullClient(pSocket, ret); 
         break ;
       case 3 :
         InformPullClient(pSocket, "CLOSE TRADE Instruction Received" );
         
         // IMPLEMENT CLOSE TRADE LOGIC HERE
         
         ret = StringFormat ( "Trade Closed (Ticket: %d)" , ticket);
         InformPullClient(pSocket, ret);
         
         break ;
      
       case 4 :
         InformPullClient(pSocket, "HISTORICAL DATA Instruction Received" );
         
         // Format: DATA|SYMBOL|TIMEFRAME|START_DATETIME|END_DATETIME
         price_count = CopyClose (compArray[ 1 ], StrToInteger (compArray[ 2 ]), 
                         StrToTime (compArray[ 3 ]), StrToTime (compArray[ 4 ]), 
                        price_array);
         
         if (price_count > 0 ) {
            
            ret = "" ;
            
             // Construct string of price|price|price|.. etc and send to PULL client.
             for ( int i = 0 ; i < price_count; i++ ) {
               
               if (i == 0 )
                  ret = compArray[ 1 ] + "|" + DoubleToStr (price_array[i], 5 );
               else if (i > 0 ) {
                  ret = ret + "|" + DoubleToStr (price_array[i], 5 );
               }   
            }
            
             Print ( "Sending: " + ret);
            
             // Send data to PULL client.
            InformPullClient(pSocket, StringFormat ( "%s" , ret));
             // ret = "";
         }
            
         break ;
         
       default : 
         break ;
   }
}

// Parse Zmq Message
void ParseZmqMessage( string & message, string & retArray[]) {
   
   Print ( "Parsing: " + message);
   
   string sep = "|" ;
   ushort u_sep = StringGetCharacter (sep, 0 );
   
   int splits = StringSplit (message, u_sep, retArray);
   
   for ( int i = 0 ; i < splits; i++) {
       Print (i + ") " + retArray[i]);
   }
}

//+------------------------------------------------------------------+
// Generate string for Bid/Ask by symbol
string GetBidAsk( string symbol) {
   
   double bid = MarketInfo (symbol, MODE_BID );
   double ask = MarketInfo (symbol, MODE_ASK );
   
   return ( StringFormat ( "%f|%f" , bid, ask));
}

// Inform Client
void InformPullClient(Socket& pushSocket, string message) {

   ZmqMsg pushReply( StringFormat ( "%s" , message));
   // pushSocket.send(pushReply,true,false);
   
   pushSocket.send(pushReply, true ); // NON-BLOCKING
   // pushSocket.send(pushReply,false); // BLOCKING
   
}
 

그리고 여기 r에 대한 코드 가 있습니다.

#+------------------------------------------------------------------+
#|                                          ZeroMQ_MT4_R_Template.R |
#|                                    Copyright 2017 , Darwinex Labs |
#|                                        https://www.darwinex.com/ |
#+------------------------------------------------------------------+

# Load "rzmq" library . If not installed, run install.packages("rzmq")
library (rzmq)

# Random placeholder for PULL later.
pull.msg <- "N/A"

# Function to send commands to ZeroMQ MT4 EA
remote.send <- function(rSocket,data) {
  send.raw. string (rSocket, data)
  msg <- receive. string (rSocket)
  
  print(msg)
}

# Function to PULL data from ZeroMQ MT4 EA PUSH socket.
remote.pull <- function(pSocket) {

  msg <- receive.socket(pSocket, unserialize = FALSE , dont.wait = TRUE )
  
   if (is.null(msg)) {
    msg <- "No data PUSHED yet.."
    print(msg)
  } else {
    msg <- rawToChar(msg)
    print(msg)  
  }

   return (msg)
}

# CREATE ZeroMQ Context
context = init.context()

# Initialize ZeroMQ REQ Socket
reqSocket = init.socket(context,"ZMQ_REQ")

# Initialize ZeroMQ PULL Socket
pullSocket = init.socket(context, "ZMQ_PULL")

# Connect to REQ Socket on port 5555
connect.socket(reqSocket,"tcp://localhost: 5555 ")

# Connect to PULL Socket on port 5556
connect.socket(pullSocket,"tcp://localhost: 5556 ")

# Run Tests
while ( TRUE ) {
  
  # REMEMBER: If the data you're pulling isn't "downloaded" in MT4's History Centre,
  #           it's very likely your PULL will produce no data.
  
  #           So if you're going to be pulling data for a currency pair from MT4,
  #           make sure its data is downloaded, and chart open just in case .
  
  # Pull from server
  remote.pull(pullSocket)
  
  f <- file("stdin")
  open(f)
  
  print("Enter Command for MetaTrader 4 ZeroMQ Server, 'q' to quit")
  # e.g. RATES|EURUSD -> Retrieves Current Bid / Ask for EURUSD from MT4.
  mt4.command <- readLines(f, n= 1 )
  
   if (tolower(mt4.command) == "q") {
     break
  }
  
  # Send to ZeroMQ MetaTrader 4 Server
   if (!grepl("PULL", mt4.command))
    remote.send(reqSocket, mt4.command)
  
  # Pull from ZeroMQ MetaTrader 4 Server
  pull.msg <- remote.pull(pullSocket)
}
사유: