顺水外汇EA交易网MT4
标题:
自编远程跟单系统,同时可本机一对多账户
[打印本页]
作者:
翻开一页
时间:
2014-10-4 14:16
标题:
自编远程跟单系统,同时可本机一对多账户
远程1台电脑对多台电脑, 远程喊单,跟单:1.把”喊单.ex4” 文件拷贝到电脑1目录:…\MT4_1\MQL4\experts\喊单.ex42.把”喊单服务器.exe” 文件拷贝到的电脑1目录:…\MT4_1\MQL4\Files\喊单服务器.exe3.把”跟单.ex4” 文件拷贝到电脑2,3,4…目录:…\MT4_1\MQL4\experts\跟单.ex44.把”跟单客户端.exe” 文件拷贝到的电脑2,3,4…目录:…\MT4_1\MQL4\Files\跟单客户端.exe5. 电脑1 打开MT4挂“喊单.ex4”程序在EURUSD图表上,参数“跟单模式=远程”6. 电脑1 运行…\MT4_1\MQL4\Files\喊单服务器.exe,设置端口号,默认60007. 电脑2,3,4 打开MT4挂“跟单.ex4”程序在EURUSD图表上,参数“跟单模式=远程”8. 电脑2,3,4 运行…\MT4_1\MQL4\Files\跟单客户端.exe,设置远程喊单服务器的IP地址和端口号9.服务端,直接与电信宽带连接的无需设置映射,打开网络连接可以查询IP地址,端口号自己设定10.使用内部无线路由器和有线路由器的需要对路由器虚拟服务器,做内外网络IP地址和端口进行映射,举例如下: 路由器工作模式:NAT打开 路由器虚拟服务器设置:启用 内网本机地址:192.168.1.100:端口范围5000-6000(举例) 设置如有问题,请提出讨论
本地一台电脑一对多账户喊单跟单:1.把”喊单.ex4” 文件拷贝到电脑1目录:…\MT4_1\MQL4\experts\喊单.ex42.把”跟单.ex4” 文件拷贝到电脑1目录:…\MT4_2\MQL4\experts\跟单.ex43. 电脑1 打开MT4_1挂“喊单.ex4”程序在EURUSD图表上,参数“跟单模式=本地”4. 电脑1 打开MT4_2挂“跟单.ex4”程序在EURUSD图表上,参数“跟单模式=本地”5.无需运行喊单服务器.exe,跟单客户端.exe
跟单功能:1. 喊单有一单,跟单就下一单,总单数和下单类型不限制2. 喊单平/删一单,跟单就平/删一单,平单总数和类型不限制3. 喊单修改任何一单,跟单就修改相同一单,跟单就平/删一单总数和类型不限制
这是一般功能的,需要复杂功能的可定制游客,如果您要查看本帖隐藏内容请
作者:
西瓜不是瓜
时间:
2017-4-15 17:42
看看 看看看 看看
作者:
问鼎天下
时间:
2017-5-13 16:59
解压密码是多少呢
作者:
问鼎天下
时间:
2017-5-13 17:00
解压密码是多少呢
作者:
xieyuh
时间:
2017-5-13 21:56
看看看吧
作者:
mmy88
时间:
2017-5-14 16:40
1111111111111111
作者:
ytywsy
时间:
2017-5-20 09:08
520FX有你更精彩
作者:
yxz0591
时间:
2017-6-17 21:27
看着好高级啊,估计不会用
作者:
福相随
时间:
2017-7-6 18:53
伸手习惯了,慢慢的习气就坏了
作者:
tankhang
时间:
2017-7-28 15:36
多谢楼主分享
作者:
裕酆
时间:
2017-9-3 22:39
真的不错,楼主问个问题,能同时设置止损吗
作者:
2357186528
时间:
2017-9-7 17:37
不着能跨平台跟单不
作者:
zxfzwzy
时间:
2017-9-15 23:36
//+------------------------------------------------------------------+
//| EA_Arbitrage.mq4 |
//| Copyright 2015, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "跟单EA - 有道[url=]智能交易[/url]"
#property link "https://shop136951533.taobao.com"
#property version "1.00"
#property description "EA委托开发 请联系 QQ15826744."
#property strict
#import "kernel32.dll"
int CopyFileW(string SrcDirectory,string DstDirectory,bool ReWrite);
bool CreateDirectoryW(string DstDirectory,int createType);
#import
enum COPY_TYPE {发送端,接收端};
input COPY_TYPE EA_TYPE = 接收端; //= 运行模式
input string Switch = "C:\\COPYLOT_TEMP_YD"; //= 交换目录(除非必要 不要更改)
input int CopySpeed = 50; //= 检索订单速度(越小越快)
input bool ShowPanel = true; //= 接收端显示主账户订单列表
struct POSITION {
uint tk;
string symbol;
datetime openTime;
uint odType;
double lots;
double openprice;
double stoploss;
double takeprofit;
double profit;
int magic;
int copytk;
};
int file_handle;
string FilePath,FilePath_Absolute,SwitchPath;
string FILE_NAME = "SwitchFile.csv";
POSITION Pos[];
int PanelTop = 18;
int RowH = 18;
int EditWidth[] = {90,70,125,80,65,65,65,65,65,90,90};
double EditWidthPec[] = {0.1,0.085,0.1445,0.0925,0.0925,0.0751,0.0751,0.0751,0.0751,0.1,0.1};
int OnInit(){
FilePath = "CopyLotsTemp" + "\\" + FILE_NAME;
FilePath_Absolute = TerminalInfoString(TERMINAL_DATA_PATH) + "\\MQL4\\Files\\" + FilePath;
SwitchPath = Switch + "\\" + FILE_NAME;
if(EA_TYPE == 1){
if(ShowPanel) PosPanelCreate();
}
if(EA_TYPE == 0){
CreateDirectoryW(Switch,0);
}
EventSetMillisecondTimer(CopySpeed);
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason){
ObjectsDeleteAll();
EventKillTimer();
}
void OnTimer(){
int i,cnt;
if(EA_TYPE == 0){
file_handle = FileOpen(FilePath,FILE_WRITE|FILE_SHARE_WRITE|FILE_REWRITE|FILE_CSV,",");
if(file_handle!=INVALID_HANDLE){
//Print("File opened..");
for(cnt = 0; cnt eadString(file_handle));//OrderTicket(),
Pos
.symbol = (string) (FileReadString(file_handle));//OrderSymbol(),
Pos
.openTime = (long) (FileReadString(file_handle));//OrderOpenTime(),
Pos
.odType = (uint) (FileReadString(file_handle));//OrderType(),
Pos
.lots = (double) (FileReadString(file_handle));//OrderLots(),
Pos
.openprice = (double) (FileReadString(file_handle));//OrderOpenPrice(),
Pos
.stoploss = (double) (FileReadString(file_handle));//OrderStopLoss(),
Pos
.takeprofit = (double) (FileReadString(file_handle));//OrderTakeProfit(),
Pos
.profit = (double) (FileReadString(file_handle));//OrderProfit(),
Pos
.magic = (int) (FileReadString(file_handle));//OrderMagicNumber());*/
//Print("next::",FileReadString(file_handle));
//Print(/*"i:",i," ",*/Pos
.tk);
i++;
}
} else Print(GetLastError());
FileClose(file_handle);
//根据条件跟踪下单/平仓
bool tkCopyed,tkClosed;
int odTicket,odType,tkSend,tkClose;
double odLot,odOpenprice,odStoploss,odTakeprofit;
string odSymbol;
for(i = 1; i 0) {tkCopyed = true; continue;}
for(cnt = 0; cnt = 0){
PosRowDestory(i);
i++;
} else break;
}
}
//PosPanelRedrow();
}
}
void OnTick(){
}
//+------------------------------------------------------------------+
//| PosPanelRedrow 主账户订单列表创建
//+------------------------------------------------------------------+
void PosPanelCreate(){
RectLabelCreate(0,"PosPanel",0,0,PanelTop,ChartGetInteger(0,CHART_WIDTH_IN_PIXELS),200,clrWheat,BORDER_FLAT,CORNER_LEFT_UPPER,clrBlack,STYLE_SOLID,1,false,false,true,0);
LabelCreate(0,"TT",0,10,PanelTop+10,0,"主账户订单列表","Arial",9,111,0,ANCHOR_LEFT_UPPER,false,false,true,0);
if(!PosRowIsExist(0)) PosRowCreate(0);
}
//+------------------------------------------------------------------+
//| PosPanelRedrow 主账户订单列表重画
//+------------------------------------------------------------------+
void PosPanelRedrow(){
int i = 0;
while(true){
if(ObjectFind(0,"PosRow_"+i+"_"+1) >= 0){
PosRowRedrow(i);
i++;
} else break;
}
}
//+------------------------------------------------------------------+
//| PosRowIsExist 确定特定行号记录存在
//+------------------------------------------------------------------+
bool PosRowIsExist(int row){
if(ObjectFind(0,"PosRow_"+row+"_"+1) >= 0) return(true);
else return(false);
}
//+------------------------------------------------------------------+
//| ODType 返回订单类型文本
//+------------------------------------------------------------------+
string ODType(int odType){
string type;
switch(odType){
case 0: return("BUY");
case 1: return("SELL");
case 2: return("BUY LIMIT");
case 3: return("SELL LIMIT");
case 4: return("BUY STOP");
case 5: return("SELL STOP");
default: return("NULL");
}
}
//+------------------------------------------------------------------+
//| PosRowRedrow 主账户订单列表单条记录创建
//+------------------------------------------------------------------+
void PosRowCreate(int row){
int i;
int EditX[11];
int txSize = 8;
EditX[0] = 10;
if(ChartGetInteger(0,CHART_WIDTH_IN_PIXELS) 6){
return(StringSubstr(Symbol(),6,StringLen(Symbol()) - 6));
} else {
return("");
}
}
//+------------------------------------------------------------------+
//| 改变 rectangle label 控件尺寸
//+------------------------------------------------------------------+
bool RectLabelChangeSize(const long chart_ID=0, // chart's ID
const string name="RectLabel", // label name
const int width=50, // label width
const int height=18) // label height
{
//--- reset the error value
ResetLastError();
//--- change label size
if(!ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width))
{
Print(__FUNCTION__,
": failed to change the label's width! Error code = ",GetLastError());
return(false);
}
if(!ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height))
{
Print(__FUNCTION__,
": failed to change the label's height! Error code = ",GetLastError());
return(false);
}
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| 创建 rectangle label 控件
//+------------------------------------------------------------------+
bool RectLabelCreate(const long chart_ID=0, // chart's ID
const string name="RectLabel", // label name
const int sub_window=0, // subwindow index
const int x=0, // X coordinate
const int y=0, // Y coordinate
const int width=50, // width
const int height=18, // height
const color back_clr=C'236,233,216', // background color
const ENUM_BORDER_TYPE border=BORDER_SUNKEN, // border type
const ENUM_BASE_CORNER corner=CORNER_LEFT_UPPER, // chart corner for anchoring
const color clr=clrRed, // flat border color (Flat)
const ENUM_LINE_STYLE style=STYLE_SOLID, // flat border style
const int line_width=1, // flat border width
const bool back=false, // in the background
const bool selection=false, // highlight to move
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
//--- reset the error value
ResetLastError();
//--- create a rectangle label
if(!ObjectCreate(chart_ID,name,OBJ_RECTANGLE_LABEL,sub_window,0,0))
{
Print(__FUNCTION__,
": failed to create a rectangle label! Error code = ",GetLastError());
return(false);
}
//--- set label coordinates
ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
//--- set label size
ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width);
ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height);
//--- set background color
ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,back_clr);
//--- set border type
ObjectSetInteger(chart_ID,name,OBJPROP_BORDER_TYPE,border);
//--- set the chart's corner, relative to which point coordinates are defined
ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
//--- set flat border color (in Flat mode)
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set flat border line style
ObjectSetInteger(chart_ID,name,OBJPROP_STYLE,style);
//--- set flat border width
ObjectSetInteger(chart_ID,name,OBJPROP_WIDTH,line_width);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the label by mouse
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| 创建 Label 控件
//+------------------------------------------------------------------+
bool LabelCreate(const long chart_ID=0, // chart's ID
const string name="Label", // label name
const int sub_window=0, // subwindow index
const int x=0, // X coordinate
const int y=0, // Y coordinate
const ENUM_BASE_CORNER corner=CORNER_LEFT_UPPER, // chart corner for anchoring
const string text="Label", // text
const string font="Arial", // font
const int font_size=10, // font size
const color clr=clrRed, // color
const double angle=0.0, // text slope
const ENUM_ANCHOR_POINT anchor=ANCHOR_LEFT_UPPER, // anchor type
const bool back=false, // in the background
const bool selection=false, // highlight to move
const bool hidden=true, // hidden in the object list
const long z_order=0) // priority for mouse click
{
//--- reset the error value
ResetLastError();
//--- create a text label
if(!ObjectCreate(chart_ID,name,OBJ_LABEL,sub_window,0,0))
{
Print(__FUNCTION__,
": failed to create text label! Error code = ",GetLastError());
return(false);
}
//--- set label coordinates
ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
//--- set the chart's corner, relative to which point coordinates are defined
ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
//--- set the text
ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
//--- set text font
ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
//--- set font size
ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
//--- set the slope angle of the text
ObjectSetDouble(chart_ID,name,OBJPROP_ANGLE,angle);
//--- set anchor type
ObjectSetInteger(chart_ID,name,OBJPROP_ANCHOR,anchor);
//--- set color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the label by mouse
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| 创建 Edit 控件
//+------------------------------------------------------------------+
bool EditCreate(const long chart_ID = 0, // chart's ID
const string name = "Edit", // object name
const int sub_window = 0, // subwindow index
const int x = 0, // X coordinate
const int y = 0, // Y coordinate
const int width = 50, // width
const int height = 18, // height
const string text = "Text", // text
const string font = "Arial", // font
const int font_size = 10, // font size
const ENUM_ALIGN_MODE align = ALIGN_CENTER, // alignment type
const bool read_only = false, // ability to edit
const ENUM_BASE_CORNER corner = CORNER_LEFT_UPPER, // chart corner for anchoring
const color clr = clrBlack, // text color
const color back_clr = clrWhite, // background color
const color border_clr = clrNONE, // border color
const bool back = false, // in the background
const bool selection = false, // highlight to move
const bool hidden = true, // hidden in the object list
const long z_order = 0){ // priority for mouse click
//--- reset the error value
ResetLastError();
//--- create edit field
if(!ObjectCreate(chart_ID,name,OBJ_EDIT,sub_window,0,0)){
Print(__FUNCTION__,
": failed to create \"Edit\" object! Error code = ",GetLastError());
return(false);
}
//--- set object coordinates
ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y);
//--- set object size
ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width);
ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height);
//--- set the text
ObjectSetString(chart_ID,name,OBJPROP_TEXT,text);
//--- set text font
ObjectSetString(chart_ID,name,OBJPROP_FONT,font);
//--- set font size
ObjectSetInteger(chart_ID,name,OBJPROP_FONTSIZE,font_size);
//--- set the type of text alignment in the object
ObjectSetInteger(chart_ID,name,OBJPROP_ALIGN,align);
//--- enable (true) or cancel (false) read-only mode
ObjectSetInteger(chart_ID,name,OBJPROP_READONLY,read_only);
//--- set the chart's corner, relative to which object coordinates are defined
ObjectSetInteger(chart_ID,name,OBJPROP_CORNER,corner);
//--- set text color
ObjectSetInteger(chart_ID,name,OBJPROP_COLOR,clr);
//--- set background color
ObjectSetInteger(chart_ID,name,OBJPROP_BGCOLOR,back_clr);
//--- set border color
ObjectSetInteger(chart_ID,name,OBJPROP_BORDER_COLOR,border_clr);
//--- display in the foreground (false) or background (true)
ObjectSetInteger(chart_ID,name,OBJPROP_BACK,back);
//--- enable (true) or disable (false) the mode of moving the label by mouse
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTABLE,selection);
ObjectSetInteger(chart_ID,name,OBJPROP_SELECTED,selection);
//--- hide (true) or display (false) graphical object name in the object list
ObjectSetInteger(chart_ID,name,OBJPROP_HIDDEN,hidden);
//--- set the priority for receiving the event of a mouse click in the chart
ObjectSetInteger(chart_ID,name,OBJPROP_ZORDER,z_order);
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| 删除 Edit 控件
//+------------------------------------------------------------------+
bool EditDelete(const long chart_ID = 0, // chart's ID
const string name = "Edit"){ // object name
//--- reset the error value
ResetLastError();
//--- delete the label
if(!ObjectDelete(chart_ID,name)){
Print(__FUNCTION__,
": failed to delete \"Edit\" object! Error code = ",GetLastError());
return(false);
}
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| 更改 Edit 控件尺寸
//+------------------------------------------------------------------+
bool EditChangeSize(const long chart_ID = 0, // chart's ID
const string name = "Edit", // object name
const int width = 0, // width
const int height = 0){ // height
//--- reset the error value
ResetLastError();
//--- change the object size
if(!ObjectSetInteger(chart_ID,name,OBJPROP_XSIZE,width)){
Print(__FUNCTION__,
": failed to change the object width! Error code = ",GetLastError());
return(false);
}
if(!ObjectSetInteger(chart_ID,name,OBJPROP_YSIZE,height)){
Print(__FUNCTION__,
": failed to change the object height! Error code = ",GetLastError());
return(false);
}
//--- successful execution
return(true);
}
//+------------------------------------------------------------------+
//| 移动 Edit 控件位置
//+------------------------------------------------------------------+
bool EditMove(const long chart_ID = 0, // chart's ID
const string name = "Edit", // object name
const int x = 0, // X coordinate
const int y = 0){ // Y coordinate
//--- reset the error value
ResetLastError();
//--- move the object
if(!ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x)){
Print(__FUNCTION__,
": failed to move X coordinate of the object! Error code = ",GetLastError());
return(false);
}
if(!ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y)){
Print(__FUNCTION__,
": failed to move Y coordinate of the object! Error code = ",GetLastError());
return(false);
}
//--- successful execution
return(true);
}
作者:
herifle
时间:
2017-10-22 21:48
非常感谢,锡类看看
作者:
jila999999
时间:
2017-12-16 22:19
希望有源码参考
作者:
shamanjay
时间:
2017-12-19 15:53
从东方东方打发士大夫
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2