Forex_AI_AutoTrader_v2.1 + mq4

Forex_AI_AutoTrader_v2.1 + mq4最新版

官方版无广告347

更新日期:2022-03-14分类标签: 语言:中文平台:没限制

71 人已下载 手机查看

/*
Free EX4 To MQ4 Decompile Service
E-mail : ex4free@gmail.com
*/
#property copyright “Copyright ?2008, Gary White”
#property link “http://www.forex-ai.com”

extern string ModeHelp = “A-Auto, F-Fixed Lot”;
extern string Mode = “A”;
extern double Lots = 0.1;
extern int LotsMarginForOne = 2000;
extern int LotsDeltaMargin = 2000;
extern int alpha = 114;
extern int beta = 132;
extern int gamma = 156;
extern int delta = 199;
extern string alt_symbol = “CL_CONT”;
extern int alt_alpha = 200;
extern int alt_beta = 42;
extern int alt_gamma = 81;
extern int alt_delta = 160;
extern double StopLoss = 90.0;
extern bool ClosePositionsOnly = FALSE;
string gs_eurusd_160 = “EURUSD”;
string gs_forex_ai_168 = “Forex-Ai”;
string gs_176 = “”;
int g_magic_184 = 541;
int gi_188 = 0;
int gi_unused_192 = 3;
double g_point_196;

int init() {
if (Point == 0.00001) g_point_196 = 0.0001;
else {
if (Point == 0.001) g_point_196 = 0.01;
else g_point_196 = Point;
}
return (0);
}

int deinit() {
return (0);
}

int start() {
int l_ticket_24;
string ls_0 = “2009.02.28”;
int l_str2time_8 = StrToTime(ls_0);
/* if (TimeCurrent() >= l_str2time_8) {
Comment(“The trial version has been expired! If you have purchased the licensed copy, email: support@forex-ai.com”);
return (0);
} */
if (Symbol() != gs_eurusd_160) {
Comment(“This Expert will only work on the EURUSD currency pair”);
return (0);
}
if (Period() != PERIOD_H4) {
Comment(“This Expert will only work on the H4 chart, please switch back to H4 otherwise it will not execute the trades properly!!!”);
return (0);
}
/* if (gs_forex_ai_168 != “Forex-Ai”) {
Comment(“Wrong password!”);
return (0);
}
if (!(AccountNumber() == 279750 || AccountNumber() == 393368)) {
} */
if (ClosePositionsOnly == FALSE) gs_176 = “The system will trade ” + DoubleToStr(GetLotSize(), 2) + ” lots.”;
else gs_176 = “The system will only focus on closing existing positions”;
gs_176 = gs_176 + ” F:” + Fperceptron();
gs_176 = gs_176 + ” A:” + Cperceptron();
Comment(gs_176);
if (Time[0] == gi_188) return (0);
gi_188 = Time[0];
if (IsTradeAllowed()) {
RefreshRates();
gi_unused_192 = MarketInfo(gs_eurusd_160, MODE_SPREAD);
} else {
gi_188 = Time[1];
return (0);
}
int l_ticket_12 = -1;
int l_ord_total_16 = OrdersTotal();
for (int l_pos_20 = 0; l_pos_20 < l_ord_total_16; l_pos_20++) {
OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == gs_eurusd_160 && OrderMagicNumber() == g_magic_184) {
l_ticket_24 = OrderTicket();
if (OrderType() == OP_BUY) {
if (Fperceptron() < 0.0 && Cperceptron() < 0.0) {
Lots = GetLotSize();
if (ClosePositionsOnly) {
Comment(“Closing existing position ” + DoubleToStr(Lots, 2) + ” lot”);
OrderClose(l_ticket_24, Lots, 0, 3, Yellow);
Sleep(30000);
} else {
l_ticket_12 = OrderSend(Symbol(), OP_SELL, 2.0 * Lots, Bid, 3, Ask + StopLoss * g_point_196, 0, “AI”, g_magic_184, 0, Red);
OrderModify(l_ticket_12, OrderOpenPrice(), 0, 0, 0, Yellow);
Sleep(30000);
if (l_ticket_12 < 0) gi_188 = Time[1];
else OrderCloseBy(l_ticket_12, l_ticket_24, Brown);
}
} else {
if (OrderStopLoss() < Bid – StopLoss * g_point_196) {
if (!OrderModify(OrderTicket(), OrderOpenPrice(), Bid – StopLoss * g_point_196, 0, 0, Red)) {
Sleep(30000);
gi_188 = Time[1];
}
}
}
} else {
if (Fperceptron() > 0.0 && Cperceptron() > 0.0) {
Lots = GetLotSize();
if (ClosePositionsOnly) {
Comment(“Closing existing position ” + DoubleToStr(Lots, 2) + ” lot”);
OrderClose(l_ticket_24, Lots, 0, 3, Yellow);
Sleep(30000);
} else {
l_ticket_12 = OrderSend(Symbol(), OP_BUY, 2.0 * Lots, Ask, 3, 0, 0, “AI”, g_magic_184, 0, Blue);
OrderModify(l_ticket_12, OrderOpenPrice(), Bid – StopLoss * g_point_196, 0, 0, Yellow);
Sleep(30000);
if (l_ticket_12 < 0) gi_188 = Time[1];
else OrderCloseBy(l_ticket_12, l_ticket_24, Black);
}
} else {
if (OrderStopLoss() > Ask + StopLoss * g_point_196) {
if (!OrderModify(OrderTicket(), OrderOpenPrice(), Ask + StopLoss * g_point_196, 0, 0, Blue)) {
Sleep(30000);
gi_188 = Time[1];
}
}
}
}
return (0);
}
}
if (!ClosePositionsOnly) {
if (Fperceptron() > 0.0 && Cperceptron() > 0.0) {
Lots = GetLotSize();
Comment(Lots + ” buy order about to be sent”);
l_ticket_12 = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, “AI”, g_magic_184, 0, Green);
Comment(“OrderSend failed with error #”, GetLastError() + ” Bid: ” + Bid + ” S/L: ” + ((Bid – StopLoss * g_point_196)));
if (l_ticket_12 < 0) {
Sleep(10000);
gi_188 = Time[1];
} else OrderModify(l_ticket_12, OrderOpenPrice(), Bid – StopLoss * g_point_196, 0, 0, Yellow);
} else {
if (Fperceptron() < 0.0 && Cperceptron() < 0.0) {
Lots = GetLotSize();
l_ticket_12 = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, 0, “AI”, g_magic_184, 0, Yellow);
if (l_ticket_12 < 0) {
Sleep(10000);
gi_188 = Time[1];
} else OrderModify(l_ticket_12, OrderOpenPrice(), Ask + StopLoss * g_point_196, 0, 0, Yellow);
}
}
}
return (0);
}

double Fperceptron() {
double ld_0 = alpha – 100;
double ld_8 = beta – 100;
double ld_16 = gamma – 100;
double ld_24 = delta – 100;
double l_iac_32 = iAC(Symbol(), 0, 0);
double l_iac_40 = iAC(Symbol(), 0, 7);
double l_iac_48 = iAC(Symbol(), 0, 14);
double l_iac_56 = iAC(Symbol(), 0, 21);
return (ld_0 * l_iac_32 + ld_8 * l_iac_40 + ld_16 * l_iac_48 + ld_24 * l_iac_56);
}

double Cperceptron() {
double ld_0 = alt_alpha – 100;
double ld_8 = alt_beta – 100;
double ld_16 = alt_gamma – 100;
double ld_24 = alt_delta – 100;
double l_iac_32 = iAC(alt_symbol, 0, 0);
double l_iac_40 = iAC(alt_symbol, 0, 7);
double l_iac_48 = iAC(alt_symbol, 0, 14);
double l_iac_56 = iAC(alt_symbol, 0, 21);
return (ld_0 * l_iac_32 + ld_8 * l_iac_40 + ld_16 * l_iac_48 + ld_24 * l_iac_56);
}

double GetLotSize() {
double ld_ret_0;
if (Mode == “F”) ld_ret_0 = Lots;
if (Mode == “A”) ld_ret_0 = MathCeil((AccountFreeMargin() – LotsMarginForOne) / LotsDeltaMargin) / 10.0;
if (ld_ret_0 < 0.1) ld_ret_0 = 0.1;
return (ld_ret_0);
}

如果你对文件有了解,请帮助投票!

If you are familiar with the file, please help vote!

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位投票人。

相关资源

暂无评论

暂无评论...
Ads Blocker Image Powered by Code Help Pro

检测到广告拦截程序!!!Ads Blocker Detected!!!

我们检测到您正在使用扩展来屏蔽广告。请通过禁用这些广告屏蔽程序或者把网站加入白名单来支持我们。

We have detected that you are using an extension to block advertisements. Please support us by disabling these advertising blocking programs or adding the website to the whitelist.