顺水外汇EA交易网MT4
标题:
2007年智能交易大赛冠军的EA-better
[打印本页]
作者:
xishuiyunkong
时间:
2018-1-11 00:57
标题:
2007年智能交易大赛冠军的EA-better
2007自动交易锦标赛的获胜者
2007自动交易锦标赛已经过去。大赛的获胜者们已经得到了他们的奖杯和奖金。
第一名被来自乌克兰的 Olexandr Topchylo获得。他的智能交易获得了
130 000
美元(竞赛起始资金10 000 美元),远远领先其它参赛者 。 Olexandr获得由锦标赛主要赞助商ODL Securities Limited 提供的 40 000 美元的奖金。
以下为其参赛的EA-better的MQL4破解源码,供大家参考。如有投诉,将立即删除!
#include extern double lots = 0.1;extern int Slippage = 2;extern int Warp = 67;extern double Deviation = 1.85;extern int Amplitude = 155;extern double Distortion = 0.79;extern bool SL_long_EQUAL_SL_short = FALSE;extern double SL_long = 80.0;extern double SL_short = 65.0;extern bool UseSound = TRUE;extern int MagicNumber = 55555;string gs_140 = "PNN Shell ?2008, FX-Systems Co Ltd";int g_time_148 = 0;int gi_152 = 6;double gd_156 = 5.0;double gd_164 = 25.0;void init() { if (SL_long_EQUAL_SL_short == TRUE) SL_short = SL_long;}void deinit() {}void start() { int l_spread_0; int li_4; int l_ord_total_8; int l_ticket_16; ExternalParametersCheck(); CheckConditions(); if (Time[0] != g_time_148) { g_time_148 = Time[0]; l_spread_0 = 3; if (IsTradeAllowed()) { RefreshRates(); l_spread_0 = MarketInfo(Symbol(), MODE_SPREAD); } else { g_time_148 = Time[1]; return; } li_4 = -1; l_ord_total_8 = OrdersTotal(); for (int l_pos_12 = l_ord_total_8 - 1; l_pos_12 >= 0; l_pos_12--) { OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) { l_ticket_16 = OrderTicket(); if (OrderType() == OP_BUY) { if (Bid = OrderStopLoss() - (2.0 * SL_short + l_spread_0) * Point) return; if (Direction(Warp, Deviation, Amplitude, Distortion) > 0.0) { li_4 = OrderSendReliable(Symbol(), OP_BUY, lots, Ask, Slippage, Bid - SL_long * Point, 0, gs_140, MagicNumber, 0, Blue); Sleep(30000); if (li_4 0.0) { li_4 = OrderSendReliable(Symbol(), OP_BUY, lots, Ask, Slippage, Bid - SL_long * Point, 0, gs_140, MagicNumber, 0, Blue); if (li_4 10) { Comment("... 青溧眍 耠桫觐?恹耦觐?珥圜屙桢 镳铖赅朦琨忄龛 Slippage,", "\n", "... 殃铕疱牝桊箝蝈 黩钺?猁腩 礤 犷脲?10??镥疱玎矬耱栩?耧屦?"); return; } if (Warp > 100 || Warp 2.0 || Warp 200 || Amplitude 1.0 || Distortion 0) { a_price_20 = NormalizeDouble(a_price_20, l_digits_72); a_price_32 = NormalizeDouble(a_price_32, l_digits_72); a_price_40 = NormalizeDouble(a_price_40, l_digits_72); } if (a_price_32 != 0.0) OrderReliable_EnsureValidStop(a_symbol_0, a_price_20, a_price_32); int l_error_76 = GetLastError(); l_error_76 = 0; bool li_80 = FALSE; bool li_84 = FALSE; int l_ticket_88 = -1; if (a_cmd_8 == OP_BUYSTOP || a_cmd_8 == OP_SELLSTOP) { l_count_68 = 0; while (!li_80) { if (IsTradeAllowed()) { l_ticket_88 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, a_price_20, a_slippage_28, a_price_32, a_price_40, a_comment_48, a_magic_56, a_datetime_60, a_color_64); l_error_76 = GetLastError(); } else l_count_68++; switch (l_error_76) { case 0/* NO_ERROR */: li_80 = TRUE; break; case 4/* SERVER_BUSY */: case 6/* NO_CONNECTION */: case 129/* INVALID_PRICE */: case 136/* OFF_QUOTES */: case 137/* BROKER_BUSY */: case 146/* TRADE_CONTEXT_BUSY */: l_count_68++; break; case 135/* PRICE_CHANGED */: case 138/* REQUOTE */: RefreshRates(); continue; break; case 130/* INVALID_STOPS */: ld_96 = MarketInfo(a_symbol_0, MODE_STOPLEVEL) * MarketInfo(a_symbol_0, MODE_POINT); if (a_cmd_8 == OP_BUYSTOP) { if (MathAbs(Ask - a_price_20) gi_152) li_80 = TRUE; if (li_80) { if (l_error_76 != 0/* NO_ERROR */) Print("OrderSendReliable: non-retryable error: " + ErrorDescription(l_error_76)); if (l_count_68 > gi_152) Print("OrderSendReliable: retry attempts maxed at " + gi_152); } if (!li_80) { Print("OrderSendReliable: retryable error (" + l_count_68 + "/" + gi_152 + "): " + ErrorDescription(l_error_76)); OrderReliable_SleepRandomTime(gd_156, gd_164); RefreshRates(); } } if (l_error_76 == 0/* NO_ERROR */) { Print("OrderSendReliable: apparently successful OP_BUYSTOP or OP_SELLSTOP order placed, details follow."); OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES); OrderPrint(); return (l_ticket_88); } if (!li_84) { Print("OrderSendReliable: failed to execute OP_BUYSTOP/OP_SELLSTOP, after " + l_count_68 + " retries"); Print("OrderSendReliable: failed trade: " + OrderReliable_CommandString(a_cmd_8) + " " + a_symbol_0 + "@" + a_price_20 + " tp@" + a_price_40 + " sl@" + a_price_32); Print("OrderSendReliable: last error: " + ErrorDescription(l_error_76)); return (-1); } } if (li_84) { Print("OrderSendReliable: going from limit order to market order because market is too close."); if (a_cmd_8 == OP_BUYSTOP) { a_cmd_8 = 0; a_price_20 = Ask; } else { if (a_cmd_8 == OP_SELLSTOP) { a_cmd_8 = 1; a_price_20 = Bid; } } } l_error_76 = GetLastError(); l_error_76 = 0; l_ticket_88 = -1; if (a_cmd_8 == OP_BUY || a_cmd_8 == OP_SELL) { l_count_68 = 0; while (!li_80) { if (IsTradeAllowed()) { l_ticket_88 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, a_price_20, a_slippage_28, a_price_32, a_price_40, a_comment_48, a_magic_56, a_datetime_60, a_color_64); l_error_76 = GetLastError(); } else l_count_68++; switch (l_error_76) { case 0/* NO_ERROR */: li_80 = TRUE; break; case 4/* SERVER_BUSY */: case 6/* NO_CONNECTION */: case 129/* INVALID_PRICE */: case 136/* OFF_QUOTES */: case 137/* BROKER_BUSY */: case 146/* TRADE_CONTEXT_BUSY */: l_count_68++; break; case 135/* PRICE_CHANGED */: case 138/* REQUOTE */: RefreshRates(); continue; break; default: li_80 = TRUE; } if (l_count_68 > gi_152) li_80 = TRUE; if (!li_80) { Print("OrderSendReliable: retryable error (" + l_count_68 + "/" + gi_152 + "): " + ErrorDescription(l_error_76)); OrderReliable_SleepRandomTime(gd_156, gd_164); RefreshRates(); } if (li_80) { if (l_error_76 != 0/* NO_ERROR */) Print("OrderSendReliable: non-retryable error: " + ErrorDescription(l_error_76)); if (l_count_68 > gi_152) Print("OrderSendReliable: retry attempts maxed at " + gi_152); } } if (l_error_76 == 0/* NO_ERROR */) { Print("OrderSendReliable: apparently successful OP_BUY or OP_SELL order placed, details follow."); OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES); OrderPrint(); return (l_ticket_88); } Print("OrderSendReliable: failed to execute OP_BUY/OP_SELL, after " + l_count_68 + " retries"); Print("OrderSendReliable: failed trade: " + OrderReliable_CommandString(a_cmd_8) + " " + a_symbol_0 + "@" + a_price_20 + " tp@" + a_price_40 + " sl@" + a_price_32); Print("OrderSendReliable: last error: " + ErrorDescription(l_error_76)); return (-1); } return (0);}bool OrderModifyReliable(int a_ticket_0, double a_price_4, double a_price_12, double a_price_20, int a_datetime_28, color a_color_32 = -1) { string ls_40; if (!IsConnected()) { Print("OrderModifyReliable: error: IsConnected() == false"); return (-1); } if (IsStopped()) { Print("OrderModifyReliable: error: IsStopped() == true"); return (-1); } for (int l_count_36 = 0; !IsTradeAllowed() && l_count_36 gi_152) li_56 = TRUE; if (!li_56) { Print("OrderModifyReliable: retryable error (" + l_count_36 + "/" + gi_152 + "): " + ErrorDescription(l_error_52)); OrderReliable_SleepRandomTime(gd_156, gd_164); RefreshRates(); } if (li_56) { if (l_error_52 != 0/* NO_ERROR */ && l_error_52 != 1/* NO_RESULT */) Print("OrderModifyReliable: non-retryable error: " + ErrorDescription(l_error_52)); if (l_count_36 > gi_152) Print("OrderModifyReliable: retry attempts maxed at " + gi_152); } } if (l_error_52 == 0/* NO_ERROR */) { Print("OrderModifyReliable: apparently successful modification order, updated trade details follow."); OrderSelect(a_ticket_0, SELECT_BY_TICKET, MODE_TRADES); OrderPrint(); return (TRUE); } if (l_error_52 == 1/* NO_RESULT */) { Print("OrderModifyReliable: Server reported modify order did not actually change parameters."); Print("OrderModifyReliable: redundant modification: " + a_ticket_0 + " " + ls_40 + "@" + a_price_4 + " tp@" + a_price_20 + " sl@" + a_price_12); Print("OrderModifyReliable: Suggest modifying code logic"); } Print("OrderModifyReliable: failed to execute modify after " + l_count_36 + " retries"); Print("OrderModifyReliable: failed modification: " + a_ticket_0 + " " + ls_40 + "@" + a_price_4 + " tp@" + a_price_20 + " sl@" + a_price_12); Print("OrderModifyReliable: last error: " + ErrorDescription(l_error_52)); return (FALSE);}void OrderReliable_EnsureValidStop(string a_symbol_0, double ad_8, double &ad_16) { double ld_24; if (ad_16 != 0.0) { ld_24 = MarketInfo(a_symbol_0, MODE_STOPLEVEL) * MarketInfo(a_symbol_0, MODE_POINT); if (MathAbs(ad_8 - ad_16) ad_16) ad_16 = ad_8 - ld_24; else { if (ad_8 0.0) { li_24 = MathRound(ad_8 / 0.1); ld_28 = 1.0 - 1.0 / ld_16; Sleep(1000); for (int l_count_36 = 0; l_count_36 32768.0 * ld_28) break; Sleep(1000); } } }}
作者:
梦不觉
时间:
2018-1-11 01:31
是不是假冒的啊
作者:
fgmt
时间:
2018-1-11 02:19
谢谢分享,先回帖
作者:
小卡卡
时间:
2018-1-11 03:40
载看看。谢谢楼主!
作者:
xbdhh
时间:
2018-1-11 05:08
老师辛苦了,谢谢分享!!!!!!!
作者:
xishuiyunkong
时间:
2018-1-11 05:22
回牛版,明天用代码方式再发一贴,以便查看。
作者:
xishuiyunkong
时间:
2018-1-11 06:00
[ol]
#include
extern double lots = 0.1;
extern int Slippage = 2;
extern int Warp = 67;
extern double Deviation = 1.85;
extern int Amplitude = 155;
extern double Distortion = 0.79;
extern bool SL_long_EQUAL_SL_short = FALSE;
extern double SL_long = 80.0;
extern double SL_short = 65.0;
extern bool UseSound = TRUE;
extern int MagicNumber = 55555;
string gs_140 = "PNN Shell ?2008, FX-Systems Co Ltd";
int g_time_148 = 0;
int gi_152 = 6;
double gd_156 = 5.0;
double gd_164 = 25.0;
void init() {
if (SL_long_EQUAL_SL_short == TRUE) SL_short = SL_long;
}
void deinit() {
}
void start() {
int l_spread_0;
int li_4;
int l_ord_total_8;
int l_ticket_16;
ExternalParametersCheck();
CheckConditions();
if (Time[0] != g_time_148) {
g_time_148 = Time[0];
l_spread_0 = 3;
if (IsTradeAllowed()) {
RefreshRates();
l_spread_0 = MarketInfo(Symbol(), MODE_SPREAD);
} else {
g_time_148 = Time[1];
return;
}
li_4 = -1;
l_ord_total_8 = OrdersTotal();
for (int l_pos_12 = l_ord_total_8 - 1; l_pos_12 >= 0; l_pos_12--) {
OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
l_ticket_16 = OrderTicket();
if (OrderType() == OP_BUY) {
if (Bid = OrderStopLoss() - (2.0 * SL_short + l_spread_0) * Point) return;
if (Direction(Warp, Deviation, Amplitude, Distortion) > 0.0) {
li_4 = OrderSendReliable(Symbol(), OP_BUY, lots, Ask, Slippage, Bid - SL_long * Point, 0, gs_140, MagicNumber, 0, Blue);
Sleep(30000);
if (li_4 0.0) {
li_4 = OrderSendReliable(Symbol(), OP_BUY, lots, Ask, Slippage, Bid - SL_long * Point, 0, gs_140, MagicNumber, 0, Blue);
if (li_4 10) {
Comment("... 青溧眍 耠桫觐?恹耦觐?珥圜屙桢 镳铖赅朦琨忄龛 Slippage,",
"\n", "... 殃铕疱牝桊箝蝈 黩钺?猁腩 礤 犷脲?10??镥疱玎矬耱栩?耧屦?");
return;
}
if (Warp > 100 || Warp 2.0 || Warp 200 || Amplitude 1.0 || Distortion 0) {
a_price_20 = NormalizeDouble(a_price_20, l_digits_72);
a_price_32 = NormalizeDouble(a_price_32, l_digits_72);
a_price_40 = NormalizeDouble(a_price_40, l_digits_72);
}
if (a_price_32 != 0.0) OrderReliable_EnsureValidStop(a_symbol_0, a_price_20, a_price_32);
int l_error_76 = GetLastError();
l_error_76 = 0;
bool li_80 = FALSE;
bool li_84 = FALSE;
int l_ticket_88 = -1;
if (a_cmd_8 == OP_BUYSTOP || a_cmd_8 == OP_SELLSTOP) {
l_count_68 = 0;
while (!li_80) {
if (IsTradeAllowed()) {
l_ticket_88 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, a_price_20, a_slippage_28, a_price_32, a_price_40, a_comment_48, a_magic_56, a_datetime_60, a_color_64);
l_error_76 = GetLastError();
} else l_count_68++;
switch (l_error_76) {
case 0/* NO_ERROR */:
li_80 = TRUE;
break;
case 4/* SERVER_BUSY */:
case 6/* NO_CONNECTION */:
case 129/* INVALID_PRICE */:
case 136/* OFF_QUOTES */:
case 137/* BROKER_BUSY */:
case 146/* TRADE_CONTEXT_BUSY */:
l_count_68++;
break;
case 135/* PRICE_CHANGED */:
case 138/* REQUOTE */:
RefreshRates();
continue;
break;
case 130/* INVALID_STOPS */:
ld_96 = MarketInfo(a_symbol_0, MODE_STOPLEVEL) * MarketInfo(a_symbol_0, MODE_POINT);
if (a_cmd_8 == OP_BUYSTOP) {
if (MathAbs(Ask - a_price_20) gi_152) li_80 = TRUE;
if (li_80) {
if (l_error_76 != 0/* NO_ERROR */) Print("OrderSendReliable: non-retryable error: " + ErrorDescription(l_error_76));
if (l_count_68 > gi_152) Print("OrderSendReliable: retry attempts maxed at " + gi_152);
}
if (!li_80) {
Print("OrderSendReliable: retryable error (" + l_count_68 + "/" + gi_152 + "): " + ErrorDescription(l_error_76));
OrderReliable_SleepRandomTime(gd_156, gd_164);
RefreshRates();
}
}
if (l_error_76 == 0/* NO_ERROR */) {
Print("OrderSendReliable: apparently successful OP_BUYSTOP or OP_SELLSTOP order placed, details follow.");
OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES);
OrderPrint();
return (l_ticket_88);
}
if (!li_84) {
Print("OrderSendReliable: failed to execute OP_BUYSTOP/OP_SELLSTOP, after " + l_count_68 + " retries");
Print("OrderSendReliable: failed trade: " + OrderReliable_CommandString(a_cmd_8) + " " + a_symbol_0 + "@" + a_price_20 + " tp@" + a_price_40 + " sl@" + a_price_32);
Print("OrderSendReliable: last error: " + ErrorDescription(l_error_76));
return (-1);
}
}
if (li_84) {
Print("OrderSendReliable: going from limit order to market order because market is too close.");
if (a_cmd_8 == OP_BUYSTOP) {
a_cmd_8 = 0;
a_price_20 = Ask;
} else {
if (a_cmd_8 == OP_SELLSTOP) {
a_cmd_8 = 1;
a_price_20 = Bid;
}
}
}
l_error_76 = GetLastError();
l_error_76 = 0;
l_ticket_88 = -1;
if (a_cmd_8 == OP_BUY || a_cmd_8 == OP_SELL) {
l_count_68 = 0;
while (!li_80) {
if (IsTradeAllowed()) {
l_ticket_88 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, a_price_20, a_slippage_28, a_price_32, a_price_40, a_comment_48, a_magic_56, a_datetime_60, a_color_64);
l_error_76 = GetLastError();
} else l_count_68++;
switch (l_error_76) {
case 0/* NO_ERROR */:
li_80 = TRUE;
break;
case 4/* SERVER_BUSY */:
case 6/* NO_CONNECTION */:
case 129/* INVALID_PRICE */:
case 136/* OFF_QUOTES */:
case 137/* BROKER_BUSY */:
case 146/* TRADE_CONTEXT_BUSY */:
l_count_68++;
break;
case 135/* PRICE_CHANGED */:
case 138/* REQUOTE */:
RefreshRates();
continue;
break;
default:
li_80 = TRUE;
}
if (l_count_68 > gi_152) li_80 = TRUE;
if (!li_80) {
Print("OrderSendReliable: retryable error (" + l_count_68 + "/" + gi_152 + "): " + ErrorDescription(l_error_76));
OrderReliable_SleepRandomTime(gd_156, gd_164);
RefreshRates();
}
if (li_80) {
if (l_error_76 != 0/* NO_ERROR */) Print("OrderSendReliable: non-retryable error: " + ErrorDescription(l_error_76));
if (l_count_68 > gi_152) Print("OrderSendReliable: retry attempts maxed at " + gi_152);
}
}
if (l_error_76 == 0/* NO_ERROR */) {
Print("OrderSendReliable: apparently successful OP_BUY or OP_SELL order placed, details follow.");
OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES);
OrderPrint();
return (l_ticket_88);
}
Print("OrderSendReliable: failed to execute OP_BUY/OP_SELL, after " + l_count_68 + " retries");
Print("OrderSendReliable: failed trade: " + OrderReliable_CommandString(a_cmd_8) + " " + a_symbol_0 + "@" + a_price_20 + " tp@" + a_price_40 + " sl@" + a_price_32);
Print("OrderSendReliable: last error: " + ErrorDescription(l_error_76));
return (-1);
}
return (0);
}
bool OrderModifyReliable(int a_ticket_0, double a_price_4, double a_price_12, double a_price_20, int a_datetime_28, color a_color_32 = -1) {
string ls_40;
if (!IsConnected()) {
Print("OrderModifyReliable: error: IsConnected() == false");
return (-1);
}
if (IsStopped()) {
Print("OrderModifyReliable: error: IsStopped() == true");
return (-1);
}
for (int l_count_36 = 0; !IsTradeAllowed() && l_count_36 gi_152) li_56 = TRUE;
if (!li_56) {
Print("OrderModifyReliable: retryable error (" + l_count_36 + "/" + gi_152 + "): " + ErrorDescription(l_error_52));
OrderReliable_SleepRandomTime(gd_156, gd_164);
RefreshRates();
}
if (li_56) {
if (l_error_52 != 0/* NO_ERROR */ && l_error_52 != 1/* NO_RESULT */) Print("OrderModifyReliable: non-retryable error: " + ErrorDescription(l_error_52));
if (l_count_36 > gi_152) Print("OrderModifyReliable: retry attempts maxed at " + gi_152);
}
}
if (l_error_52 == 0/* NO_ERROR */) {
Print("OrderModifyReliable: apparently successful modification order, updated trade details follow.");
OrderSelect(a_ticket_0, SELECT_BY_TICKET, MODE_TRADES);
OrderPrint();
return (TRUE);
}
if (l_error_52 == 1/* NO_RESULT */) {
Print("OrderModifyReliable: Server reported modify order did not actually change parameters.");
Print("OrderModifyReliable: redundant modification: " + a_ticket_0 + " " + ls_40 + "@" + a_price_4 + " tp@" + a_price_20 + " sl@" + a_price_12);
Print("OrderModifyReliable: Suggest modifying code logic");
}
Print("OrderModifyReliable: failed to execute modify after " + l_count_36 + " retries");
Print("OrderModifyReliable: failed modification: " + a_ticket_0 + " " + ls_40 + "@" + a_price_4 + " tp@" + a_price_20 + " sl@" + a_price_12);
Print("OrderModifyReliable: last error: " + ErrorDescription(l_error_52));
return (FALSE);
}
void OrderReliable_EnsureValidStop(string a_symbol_0, double ad_8, double &ad_16) {
double ld_24;
if (ad_16 != 0.0) {
ld_24 = MarketInfo(a_symbol_0, MODE_STOPLEVEL) * MarketInfo(a_symbol_0, MODE_POINT);
if (MathAbs(ad_8 - ad_16) ad_16) ad_16 = ad_8 - ld_24;
else {
if (ad_8 0.0) {
li_24 = MathRound(ad_8 / 0.1);
ld_28 = 1.0 - 1.0 / ld_16;
Sleep(1000);
for (int l_count_36 = 0; l_count_36 32768.0 * ld_28) break;
Sleep(1000);
}
}
}
}
[/ol]复制代码
作者:
cnlm2
时间:
2018-1-11 06:46
谢谢分享,不知道是不是真的。有时间我翻译一下。有些乱码,可能翻译不了。麻烦了。
楼主提供个ex4的文件给用下啊。
作者:
xishuiyunkong
时间:
2018-1-11 08:26
回复 5#
cnlm2
作者:
waihuiwang2009
时间:
2018-1-11 09:49
学学 楼主
作者:
zlemzlem
时间:
2018-1-11 10:09
谢谢分享,不知道是不是真的。有时间我翻译一下。有些乱码,可能翻译不了。麻烦了。
楼主提供个ex4的文件给用下啊。
作者:
neil13
时间:
2018-1-11 11:15
谁有这个EA的说明啊。。。怎么用。,。?
作者:
wisher
时间:
2018-1-11 12:08
谢谢,学习了
作者:
jackyhu
时间:
2018-1-11 12:50
谢谢,学习了
作者:
柒侠伍义
时间:
2018-1-11 13:07
[ol]
//==============================================================================
#property copyright "Copyright ?2008, AutoTrader fx-auto-trader@mail.ru"
#property link "fx-auto-trader@mail.ru"
#include
//==============================================================================
extern double 手数 = 0.1;
extern int 滑点 = 2;
extern int Warp = 67;
extern double Deviation = 1.85;
extern int Amplitude = 155;
extern double Distortion = 0.79;
extern bool SL_long_EQUAL_SL_short = FALSE;
extern double 止损 = 80.0;
extern double 小小止损 = 65.0;
//extern bool 音响 = TRUE;
extern int 魔术号码 = 55555;
string EA名称 = "PNN Shell ?2008, FX-Systems Co Ltd";
int 时段 = 0;
int 计数数目 = 6;
double 暂停修改001 = 5.0;
double 暂停修改002 = 25.0;
//==============================================================================
void init() {
if (SL_long_EQUAL_SL_short == TRUE) 小小止损 = 止损;
}
//==============================================================================
void deinit() {
}
//==============================================================================
void start() {
//==============================================================================
int 点差;
int 确定订单;
int 全部账单;
int 账单号码;
检查001();
检查002();
//==============================================================================
if (Time[0] != 时段) {
时段 = Time[0];
点差 = 3;
//==============================================================================
if (IsTradeAllowed()) {
RefreshRates();
点差 = MarketInfo(Symbol(), MODE_SPREAD);
} else {
时段 = Time[1];
return;
}
//==============================================================================
确定订单 = -1;
全部账单 = OrdersTotal();
for (int 计数002 = 全部账单 - 1; 计数002 >= 0; 计数002--) {
OrderSelect(计数002, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == 魔术号码) {
账单号码 = OrderTicket();
//=============OP_SELLOP_SELLOP_SELLOP_SELLOP_SELL=========================================
if (OrderType() == OP_BUY) {
if (Bid = OrderStopLoss() - (2.0 * 小小止损 + 点差) * Point) return;
if (指标(Warp, Deviation, Amplitude, Distortion) > 0.0) {
确定订单 = 发送订单(Symbol(), OP_BUY, 手数, Ask, 滑点, Bid - 止损 * Point, 0, EA名称, 魔术号码, 0, Blue);
Sleep(30000);
//==============================================================================
if (确定订单 0.0) {
确定订单 = 发送订单(Symbol(), OP_BUY, 手数, Ask, 滑点, Bid - 止损 * Point, 0, EA名称, 魔术号码, 0, Blue);
if (确定订单 10) {
Comment("... 青溧眍 耠桫觐?恹耦觐?珥圜屙桢 镳铖赅朦琨忄龛 滑点,",
"\n", "... 殃铕疱牝桊箝蝈 黩钺?猁腩 礤 犷脲?10??镥疱玎矬耱栩?耧屦?");
return;
}
//==============================================================================
if (Warp > 100 || Warp 2.0 || Warp 200 || Amplitude 1.0 || Distortion 0) {
货币对价钱 = NormalizeDouble(货币对价钱, 小数点);
止损价钱 = NormalizeDouble(止损价钱, 小数点);
止赢价钱 = NormalizeDouble(止赢价钱, 小数点);
}
//==============================================================================
if (止损价钱 != 0.0) 保险(货币对1, 货币对价钱, 止损价钱);
int 错误1 = GetLastError();
错误1 = 0;
bool 启动确定 = FALSE;
bool 确定开单 = FALSE;
int 账单 = -1;
//==============================================================================
if (开单种类 == OP_BUYSTOP || 开单种类 == OP_SELLSTOP) {
计数1 = 0;
while (!启动确定) {
if (IsTradeAllowed()) {
账单 = OrderSend(货币对1, 开单种类, 发送订单手数, 货币对价钱, 滑点002, 止损价钱, 止赢价钱, a_comment_48, 魔术号码002, a_datetime_60, 颜色);
错误1 = GetLastError();
} else 计数1++;
switch (错误1) {
case 0/* NO_ERROR */:
启动确定 = TRUE;
break;
case 4/* SERVER_BUSY */:
case 6/* NO_CONNECTION */:
case 129/* INVALID_PRICE */:
case 136/* OFF_QUOTES */:
case 137/* BROKER_BUSY */:
case 146/* TRADE_CONTEXT_BUSY */:
计数1++;
break;
case 135/* PRICE_CHANGED */:
case 138/* REQUOTE */:
RefreshRates();
continue;
break;
case 130/* INVALID_STOPS */:
MODE_STOPLEVEL1 = MarketInfo(货币对1, MODE_STOPLEVEL) * MarketInfo(货币对1, MODE_POINT);
//==============================================================================
if (开单种类 == OP_BUYSTOP) {
if (MathAbs(Ask - 货币对价钱) 计数数目) 启动确定 = TRUE;
if (启动确定) {
if (错误1 != 0/* NO_ERROR */) Print("发送订单: non-retryable error: " + ErrorDescription(错误1));
if (计数1 > 计数数目) Print("发送订单: retry attempts maxed at " + 计数数目);
}
//==============================================================================
if (!启动确定) {
Print("发送订单: retryable error (" + 计数1 + "/" + 计数数目 + "): " + ErrorDescription(错误1));
暂停修改订单(暂停修改001, 暂停修改002);
RefreshRates();
}
}
//==============================================================================
if (错误1 == 0/* NO_ERROR */) {
Print("发送订单: apparently successful OP_BUYSTOP or OP_SELLSTOP order placed, details follow.");
OrderSelect(账单, SELECT_BY_TICKET, MODE_TRADES);
OrderPrint();
return (账单);
}
//==============================================================================
if (!确定开单) {
Print("发送订单: failed to execute OP_BUYSTOP/OP_SELLSTOP, after " + 计数1 + " retries");
Print("发送订单: failed trade: " + OrderReliable_CommandString(开单种类) + " " + 货币对1 + "@" + 货币对价钱 + " tp@" + 止赢价钱 + " sl@" + 止损价钱);
Print("发送订单: last error: " + ErrorDescription(错误1));
return (-1);
}
}
//==============================================================================
if (确定开单) {
Print("发送订单: going from limit order to market order because market is too close.");
//==============================================================================
if (开单种类 == OP_BUYSTOP) {
开单种类 = 0;
货币对价钱 = Ask;
} else {
if (开单种类 == OP_SELLSTOP) {
开单种类 = 1;
货币对价钱 = Bid;
}
}
}
//==============================================================================
错误1 = GetLastError();
错误1 = 0;
账单 = -1;
//==============================================================================
if (开单种类 == OP_BUY || 开单种类 == OP_SELL) {
计数1 = 0;
while (!启动确定) {
if (IsTradeAllowed()) {
账单 = OrderSend(货币对1, 开单种类, 发送订单手数, 货币对价钱, 滑点002, 止损价钱, 止赢价钱, a_comment_48, 魔术号码002, a_datetime_60, 颜色);
错误1 = GetLastError();
} else 计数1++;
//==============================================================================
switch (错误1) {
case 0/* NO_ERROR */:
启动确定 = TRUE;
break;
case 4/* SERVER_BUSY */:
case 6/* NO_CONNECTION */:
case 129/* INVALID_PRICE */:
case 136/* OFF_QUOTES */:
case 137/* BROKER_BUSY */:
case 146/* TRADE_CONTEXT_BUSY */:
计数1++;
break;
case 135/* PRICE_CHANGED */:
case 138/* REQUOTE */:
RefreshRates();
continue;
break;
default:
启动确定 = TRUE;
}
//==============================================================================
if (计数1 > 计数数目) 启动确定 = TRUE;
//==============================================================================
if (!启动确定) {
Print("发送订单: retryable error (" + 计数1 + "/" + 计数数目 + "): " + ErrorDescription(错误1));
暂停修改订单(暂停修改001, 暂停修改002);
RefreshRates();
}
//==============================================================================
if (启动确定) {
if (错误1 != 0/* NO_ERROR */) Print("发送订单: non-retryable error: " + ErrorDescription(错误1));
if (计数1 > 计数数目) Print("发送订单: retry attempts maxed at " + 计数数目);
}
}
//==============================================================================
if (错误1 == 0/* NO_ERROR */) {
Print("发送订单: apparently successful OP_BUY or OP_SELL order placed, details follow.");
OrderSelect(账单, SELECT_BY_TICKET, MODE_TRADES);
OrderPrint();
return (账单);
}
Print("发送订单: failed to execute OP_BUY/OP_SELL, after " + 计数1 + " retries");
Print("发送订单: failed trade: " + OrderReliable_CommandString(开单种类) + " " + 货币对1 + "@" + 货币对价钱 + " tp@" + 止赢价钱 + " sl@" + 止损价钱);
Print("发送订单: last error: " + ErrorDescription(错误1));
return (-1);
}
return (0);
}
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
bool 修改订单(int a_ticket_0, double a_price_4, double a_price_12, double 货币对价钱, int a_datetime_28, color a_color_32 = -1) {
string ls_40;
//==============================================================================
if (!IsConnected()) {
Print("修改订单: error: IsConnected() == false");
return (-1);
}
//==============================================================================
if (IsStopped()) {
Print("修改订单: error: IsStopped() == true");
return (-1);
}
//==============================================================================
for (int l_count_36 = 0; !IsTradeAllowed() && l_count_36 计数数目) li_56 = TRUE;
//==============================================================================
if (!li_56) {
Print("修改订单: retryable error (" + l_count_36 + "/" + 计数数目 + "): " + ErrorDescription(错误52));
暂停修改订单(暂停修改001, 暂停修改002);
RefreshRates();
}
//==============================================================================
if (li_56) {
if (错误52 != 0/* NO_ERROR */ && 错误52 != 1/* NO_RESULT */) Print("修改订单: non-retryable error: " + ErrorDescription(错误52));
if (l_count_36 > 计数数目) Print("修改订单: retry attempts maxed at " + 计数数目);
}
}
//==============================================================================
if (错误52 == 0/* NO_ERROR */) {
Print("修改订单: apparently successful modification order, updated trade details follow.");
OrderSelect(a_ticket_0, SELECT_BY_TICKET, MODE_TRADES);
OrderPrint();
return (TRUE);
}
//==============================================================================
if (错误52 == 1/* NO_RESULT */) {
Print("修改订单: Server reported modify order did not actually change parameters.");
Print("修改订单: redundant modification: " + a_ticket_0 + " " + ls_40 + "@" + a_price_4 + " tp@" + 货币对价钱 + " sl@" + a_price_12);
Print("修改订单: Suggest modifying code logic");
}
Print("修改订单: failed to execute modify after " + l_count_36 + " retries");
Print("修改订单: failed modification: " + a_ticket_0 + " " + ls_40 + "@" + a_price_4 + " tp@" + 货币对价钱 + " sl@" + a_price_12);
Print("修改订单: last error: " + ErrorDescription(错误52));
return (FALSE);
}
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
//==============================================================================
void 保险(string 货币对1, double ad_8, double &指标资料4) { //ad_16==指标资料4??
double ld_24;
//==============================================================================
if (指标资料4 != 0.0) {
ld_24 = MarketInfo(货币对1, MODE_STOPLEVEL) * MarketInfo(货币对1, MODE_POINT);
if (MathAbs(ad_8 - 指标资料4) 指标资料4) 指标资料4 = ad_8 - ld_24;
else {
if (ad_8 0.0) {
li_24 = MathRound(ad_8 / 0.1);
ld_28 = 1.0 - 1.0 / ld_16;
Sleep(1000);
//==============================================================================
for (int l_count_36 = 0; l_count_36 32768.0 * ld_28) break;
Sleep(1000);
}
}
}
}
//==============================================================================
//==============================================================================
//end 柒侠伍义
//只有一个指标 iAC
//手数0.1=USD1.00
//没有限制比赛的最大手数5注码 ?有问题?
[/ol]复制代码
作者:
meng40
时间:
2018-1-11 13:41
柒侠伍义能评价一下这个ea吗!
作者:
柒侠伍义
时间:
2018-1-11 14:02
这个EA 不会下注 注码 5 就肯定不是比赛的EA....
作者:
cym138
时间:
2018-1-11 14:41
边学边灌
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2