顺水外汇EA交易网MT4
标题:
本网站EA(盈利设定自动平仓EA)求增加亏损设定自动平仓
[打印本页]
作者:
735269731
时间:
2015-4-29 16:51
标题:
本网站EA(盈利设定自动平仓EA)求增加亏损设定自动平仓
/*
Generated by EX4-TO-MQ4 decompiler V4.0.220.2c []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "Copyright ?2007, 520FX Corp."
#property link "http://www.520fx.com"
extern double 获利美元平仓数 = 50.0;
extern int SlipPoint = 3;
int gi_88 = 0;
int gi_unused_92 = 0;
int init() {
writetext("Logo", "Powered by www.520fx.com", 10, 10, Yellow, 14);
return (0);
}
int start() {
double ld_0;
if (gi_88 == TRUE) {
CloseAllOrder();
if (gi_88 == TRUE) return;
} else {
ld_0 = GetProfitsHolding();
writetext("Profit", "持仓总盈利:" + DoubleToStr(ld_0, 2), 10, 30, White, 16);
if (ld_0 > 获利美元平仓数) {
CloseAllOrder();
return (0);
}
}
return (0);
}
void writetext(string a_name_0, string a_text_8, int a_x_16, int a_y_20, color a_color_24, int a_fontsize_28) {
ObjectDelete(a_name_0);
ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0);
ObjectSetText(a_name_0, a_text_8, a_fontsize_28, "Arial", a_color_24);
ObjectSet(a_name_0, OBJPROP_CORNER, 0);
ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_16);
ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_20);
}
double GetProfitsHolding() {
double ld_ret_4 = 0;
for (int l_pos_0 = 0; l_pos_0 < OrdersTotal(); l_pos_0++) {
OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES);
ld_ret_4 += OrderProfit();
}
return (ld_ret_4);
}
void CloseAllOrder() {
int lia_0[200];
gi_88 = FALSE;
int l_index_4 = 0;
for (int l_pos_8 = 0; l_pos_8 < OrdersTotal(); l_pos_8++) {
OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
l_index_4++;
lia_0[l_index_4] = OrderTicket();
Print("全部平仓! :", lia_0[l_index_4]);
}
if (l_index_4 != 0) {
for (l_pos_8 = 1; l_pos_8 <= l_index_4; l_pos_8++) {
OrderSelect(lia_0[l_pos_8], SELECT_BY_TICKET);
if (OrderType() == OP_BUY) {
if (OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), SlipPoint) == 0) {
gi_88 = TRUE;
Print("多头平仓失败" + GetLastError());
}
}
if (OrderType() == OP_SELL) {
if (OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), SlipPoint) == 0) {
gi_88 = TRUE;
Print("空头平仓失败" + GetLastError());
}
}
}
}
}
作者:
jason_7788
时间:
2015-4-29 16:53
你这个是持仓保姆
作者:
jason_7788
时间:
2015-5-2 16:00
你应该换一个EA,内有盈利多少平仓,亏损多少平仓,只是用来出场用的,开单得有自己的方法
作者:
清风
时间:
2016-1-12 21:44
你这个是持仓保姆
作者:
comeasyouare
时间:
2016-3-26 13:33
不是 持仓保姆
这个还是很有用的 就是没有止损 楼主 修改好了 能发我一个吗 ? 谢谢
作者:
Q617058048
时间:
2017-1-5 13:48
........................
作者:
yixin1928
时间:
2017-5-19 09:54
这个还是很好用的,谢谢!
作者:
风再起时
时间:
2017-7-13 09:51
这个还是很好用的,谢谢!
作者:
suitong111
时间:
2017-10-19 22:57
就应该单独的罗列出来1、盈利多少美元自动平仓和亏损多少美元自动平仓2、盈利自动加仓,这样其实管理起来更简单,个人意见,同时我自己搞了个面板,不会写成代码,谁会http://bbs.520fx.com/forum.php?mod=viewthread&tid=95660
作者:
奔跑的馒头
时间:
2017-10-20 00:24
没钱了,没钱了,赚金币
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2