标签: mql5

使用OpenCL将MQL5的本机功能转换为GPU

我在MQL5中编写了一个用于创建指标的函数.这里我附上了指标文件.

以下是OnCalculate()指标:

int OnCalculate(const int rates_total, const int prev_calculated,const int begin,const double &price[])
  {
//--- check for bars count

   if(rates_total<InpMAPeriod-1+begin)
      return(0);// not enough bars for calculation
//--- first calculation or number of bars was changed
   if(prev_calculated==0)

      ArrayInitialize(ExtLineBuffer,0);      


//--- sets first bar from what index will be draw
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpMAPeriod-1+begin);

  switch(InpMAMethod)
     {
      case MODE_EMA:  //CalculateEMA(rates_total,prev_calculated,begin,price);        

      Execute_Me(price,"CalculateEMA",rates_total,prev_calculated,begin);


      break;
      case MODE_LWMA: //CalculateLWMA(rates_total,prev_calculated,begin,price);       

      Execute_Me(price,"CalculateLWMA",rates_total,prev_calculated,begin);

      break;
      case MODE_SMMA: //CalculateSmoothedMA(rates_total,prev_calculated,begin,price);
      Execute_Me(price,"CalculateSmoothedMA",rates_total,prev_calculated,begin);

      break;
      case MODE_SMA:  

              Execute_Me(price,"CalculateSimpleMA",rates_total,prev_calculated,begin);      
           break;
     }
return(rates_total);
  }
Run Code Online (Sandbox Code Playgroud)

请帮助我将功能转换为基于GPU而不是基于CPU.另外,请告诉我使用系统GPU的建议.

已提交,已获取:

int Execute_Me( …
Run Code Online (Sandbox Code Playgroud)

c++ indicator metatrader5 mql5

5
推荐指数
0
解决办法
173
查看次数

MQL5中的OpenCL代码不会将分布式作业提供给每个GPU核心

我使用OpenCL和MQL5为MetaTrader终端平台创建了一个基于GPU的指标.

我努力工作,我的[MetaTrader终端:策略测试程序]优化工作必须在GPU上转移到最大值.大多数计算都是由指标完成的.因此,我在指标中进行了更改,并在GPU上完全转移.

但是当我尝试在策略测试器部分进行优化过程时,真正的问题出现了.
我看到的过程同时使用了GPU和CPU,但对整个过程没有影响.

我怀疑这个过程并没有分配到每个GPU核心进行处理,而是所有GPU核心都在处理相同的进程或功能以便执行.

Kindly, let me know what I need to do to get the single GPU work for on single function execution to give faster output.

Here is my code link attached: Complete code with Expert

The kernel of my code is :

__kernel void calSMA(
                     int limit, 
                     int rates_total, 
                     __global double *price, 
                     __global double *ExtLineBuffer,
                     int InpMAPeriod

                   )
         { 

                int count = 0;
                int len = get_global_id(2);
                for(int i=limit;i<rates_total;i++) 

                     ExtLineBuffer[len+i] = ExtLineBuffer[len+ i-1]+(price[len+i]-price[len+i-InpMAPeriod])/InpMAPeriod;

         }


 __kernel void …
Run Code Online (Sandbox Code Playgroud)

parallel-processing performance opencl parallelism-amdahl mql5

5
推荐指数
1
解决办法
523
查看次数

从导入的DLL调用Metatrader MQL4/MQL5函数

我想从Metatrader中我自己导入的DLL调用MQL4或MQL5函数.

可能吗?

dll metatrader4 metatrader5 mql4 mql5

4
推荐指数
1
解决办法
7632
查看次数

如何在 Expert Advisor (EA) 中包含斐波那契水平?

我想在我的专家顾问 (EA) 中访问各种斐波那契水平,例如 23.6%、38.2%、50%、61.8% 和 100%。我如何在我的 EA 中定义这些,以便交易者可以通过输入选择它们?

我试过这个

input double Fibo=23.6;
Run Code Online (Sandbox Code Playgroud)

然而,这是常见的方法吗?是否可以将它们设置为预定义的?

感谢您的帮助!

mt4 metatrader4 metatrader5 mql4 mql5

2
推荐指数
1
解决办法
5734
查看次数

如何修改活跃交易的止损?

我在使用 MQL5 修改正在运行的交易的止损时遇到了麻烦。选择订单对我来说很有效。但是如果我尝试访问变量(例如OrderTicket()& OrderOpenPrice()),它总是返回 0.00000:

2017.06.01 00:06:32.114 2016.04.08 00:00:00   failed modify  buy 0.00  sl: 0.00000, tp: 0.00000 -> sl: 1.41594, tp: 0.00000 [Invalid request]
Run Code Online (Sandbox Code Playgroud)

这是我的止损修改无效:

void modifyStops() {

   int total = OrdersTotal();          // total number of placed pending orders
   Print( total + " Orders on the line!!!" );

   //--- Over all placed pending orders
   for ( int i = 0; i <  total; i++ )
   {     bool isOrderSelected = OrderSelect( i, SELECT_BY_POS, MODE_TRADES );
         if (  isOrderSelected …
Run Code Online (Sandbox Code Playgroud)

algorithmic-trading metatrader5 mql5

2
推荐指数
1
解决办法
6532
查看次数

对止损处理程序进行编程

我想每次自动触发止损(或获利)时执行一系列命令。

我不知道该怎么做,因为我还没有找到这些事件的处理程序。

mql5

2
推荐指数
1
解决办法
939
查看次数

如何通过 Python 关闭 MT5 订单?

我正在尝试通过 MT5-python API 将订单从 python 脚本发送到我的 MT5 终端。

我可以开仓,但如何通过 Python mt5-API 平仓?

我打开一张买票,如下所示:

import MetaTrader5 as mt5 
lot = 0.1
request = {
"action": mt5.TRADE_ACTION_DEAL,
"symbol": symbol,
"volume": lot,
"type": mt5.ORDER_TYPE_BUY,
"price": price,
.....
"type_time": mt5.ORDER_TIME_GTC,
 "type_filling": mt5.ORDER_FILLING_RETURN,
}

enter copoint = mt5.symbol_info(symbol).point
Run Code Online (Sandbox Code Playgroud)

但是发送“关闭”的命令和形式是什么?

查找更多信息: https://www.mql5.com/en/docs/integration/python_metatrader5

非常感谢!

python metatrader5 mql5

2
推荐指数
2
解决办法
1万
查看次数

使用套接字的 MetaTrader 5 和 Python 集成

我正在尝试使用套接字在 MetaTrader 5 和 Python 之间建立连接。服务器部分用 python 编写,客户端部分用 mql5 编写。客户也是 Expert Advisor,而不是指标。问题是当我同时运行服务器和客户端时,客户端给我“错误4014”。如果有人能帮助我解决这个问题,我非常感激。

在此输入图像描述

 //this is python server code
 import socket

 serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 serv.bind(('127.0.0.1', 9090))
 serv.listen(1)

 while True:
     conn, addr = serv.accept()
     print('client connected to :', addr)
     conn.close()


//This is mql5 client code
//+------------------------------------------------------------------+
//|                                               test_client_EA.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

int socket;
int OnInit()
  {
   socket=SocketCreate();
   return(INIT_SUCCEEDED);
  }

void …
Run Code Online (Sandbox Code Playgroud)

python sockets mql mql5

1
推荐指数
1
解决办法
3764
查看次数