EA_High-Profits_EUR-USD_v.6.0

EA_High-Profits_EUR-USD_v.6.0

开心版 无广告 258

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

51 人已下载 手机查看

EA_High-Profits_EUR-USD_v.6.0

#property copyright "| Last Updated: January-26 2009 | Copyright © 2009, www.forex-expert-advisor.com"
#property link "http://www.forex-expert-advisor.com"

int Gi_unused_76 = 0;
extern int MAGIC = 20082812;
extern int MAGIC2 = 20082813;
extern string Parameters_Trade = "=== Parameters of EA_High-Profits_EUR-USD ===";
extern bool Account_Mini = FALSE;
extern bool Account_Micro = FALSE;
extern bool Additional_Decimals = FALSE;
extern double Lots = 1.0;
extern int StopLoss = 33;
extern int TakeProfit = 8;
string Gs_unused_124 = "=== Parameters of (BUY Signals): ===";
int G_timeframe_132 = 2;
int G_timeframe_136 = 0;
int G_timeframe_140 = 3;
int G_timeframe_144 = PERIOD_M5;
extern int B1_IS_1 = 1;
extern int B1_IS_2 = 3;
extern int B1_IS_3 = 3;
extern int B1_SHC = 12;
extern int B1_CCI = 6;
extern int CCI_Day = -60;
extern double B1_dig1 = 0.006;
extern double B1_dig2 = 0.0;
int G_shift_188 = 0;
int Gi_192 = 3;
int Gi_196 = 0;
extern string SELL_Settings = "=== Parameters of (SELL Signals): ===";
int G_timeframe_208 = 0;
int G_timeframe_212 = PERIOD_M5;
int G_timeframe_216 = 0;
int G_timeframe_220 = 4;
int Gi_224 = 0;
extern int S1_IS_1 = 2;
extern int S1_IS_2 = 3;
extern int S1_IS_3 = 3;
extern int S1_SHC = 90;
extern int S1_CCI = 4;
extern int S1_ADX_1 = 16;
extern double S1_dig1 = 0.006;
extern double S1_dig2 = 0.0042;
int G_shift_268 = 0;
int Gi_272 = 5;
int Gi_276 = 0;
int Gi_280 = 4;
int G_slippage_284 = 1;
extern string Parameters_Money_Management = "=== Parameters of Money Management ===";
extern bool Use_Money_Management = FALSE;
extern double MaximumRisk = 0.1;
extern int MaxLots = 10;
extern double DecreaseFactor = 1.0;
bool Gi_unused_320 = TRUE;
bool Gi_unused_324 = FALSE;
bool Gi_unused_328 = FALSE;
bool Gi_unused_332 = TRUE;
int Gi_unused_336 = 0;
int Gi_unused_340 = 1;
extern string _Parameters_EAs_Management = "==== Parameters of EAs Management ===";
extern bool Use_EAs_Management = FALSE;
extern int Quantity_EAs = 3;

int init() {
return (0);
}

int deinit() {
return (0);
}

double BUY() {
int timeframe_0 = G_timeframe_132;
if (G_timeframe_132 == 0) timeframe_0 = 5;
if (G_timeframe_132 == PERIOD_M1) timeframe_0 = 15;
if (G_timeframe_132 == 2) timeframe_0 = 30;
if (G_timeframe_132 == 3) timeframe_0 = 60;
if (G_timeframe_132 == 4) timeframe_0 = 240;
if (G_timeframe_132 == PERIOD_M5) timeframe_0 = 10080;
if (G_timeframe_132 == 6) timeframe_0 = 43200;
int timeframe_4 = G_timeframe_136;
if (G_timeframe_136 == 0) timeframe_4 = 5;
if (G_timeframe_136 == PERIOD_M1) timeframe_4 = 15;
if (G_timeframe_136 == 2) timeframe_4 = 30;
if (G_timeframe_136 == 3) timeframe_4 = 60;
if (G_timeframe_136 == 4) timeframe_4 = 240;
if (G_timeframe_136 == PERIOD_M5) timeframe_4 = 10080;
if (G_timeframe_136 == 6) timeframe_4 = 43200;
int timeframe_8 = G_timeframe_140;
if (G_timeframe_140 == 0) timeframe_8 = 5;
if (G_timeframe_140 == PERIOD_M1) timeframe_8 = 15;
if (G_timeframe_140 == 2) timeframe_8 = 30;
if (G_timeframe_140 == 3) timeframe_8 = 60;
if (G_timeframe_140 == 4) timeframe_8 = 240;
if (G_timeframe_140 == PERIOD_M5) timeframe_8 = 10080;
if (G_timeframe_140 == 6) timeframe_8 = 43200;
int timeframe_12 = G_timeframe_144;
if (G_timeframe_144 == 0) timeframe_12 = 5;
if (G_timeframe_144 == PERIOD_M1) timeframe_12 = 15;
if (G_timeframe_144 == 2) timeframe_12 = 30;
if (G_timeframe_144 == 3) timeframe_12 = 60;
if (G_timeframe_144 == 4) timeframe_12 = 240;
if (G_timeframe_144 == PERIOD_M5) timeframe_12 = 10080;
if (G_timeframe_144 == 6) timeframe_12 = 43200;
double istochastic_16 = iStochastic(NULL, timeframe_0, B1_IS_1, B1_IS_2, B1_IS_3, MODE_SMA, 0, MODE_MAIN, G_shift_188);
double icci_24 = iCCI(NULL, timeframe_4, B1_CCI, PRICE_CLOSE, Gi_196);
if (iOpen(Symbol(), timeframe_8, 4) - iClose(Symbol(), timeframe_8, 0) <= B1_dig1 && iClose(NULL, timeframe_12, Gi_192) <= Ask - B1_dig2 && istochastic_16 <= B1_SHC &&
icci_24 <= CCI_Day) return (1);
return (0.0);
}

double SELL() {
int timeframe_0 = G_timeframe_208;
if (G_timeframe_208 == 0) timeframe_0 = 5;
if (G_timeframe_208 == PERIOD_M1) timeframe_0 = 15;
if (G_timeframe_208 == 2) timeframe_0 = 30;
if (G_timeframe_208 == 3) timeframe_0 = 60;
if (G_timeframe_208 == 4) timeframe_0 = 240;
if (G_timeframe_208 == PERIOD_M5) timeframe_0 = 10080;
if (G_timeframe_208 == 6) timeframe_0 = 43200;
int timeframe_4 = G_timeframe_212;
if (G_timeframe_212 == 0) timeframe_4 = 5;
if (G_timeframe_212 == PERIOD_M1) timeframe_4 = 15;
if (G_timeframe_212 == 2) timeframe_4 = 30;
if (G_timeframe_212 == 3) timeframe_4 = 60;
if (G_timeframe_212 == 4) timeframe_4 = 240;
if (G_timeframe_212 == PERIOD_M5) timeframe_4 = 10080;
if (G_timeframe_212 == 6) timeframe_4 = 43200;
int timeframe_8 = G_timeframe_216;
if (G_timeframe_216 == 0) timeframe_8 = 5;
if (G_timeframe_216 == PERIOD_M1) timeframe_8 = 15;
if (G_timeframe_216 == 2) timeframe_8 = 30;
if (G_timeframe_216 == 3) timeframe_8 = 60;
if (G_timeframe_216 == 4) timeframe_8 = 240;
if (G_timeframe_216 == PERIOD_M5) timeframe_8 = 10080;
if (G_timeframe_216 == 6) timeframe_8 = 43200;
int timeframe_12 = G_timeframe_220;
if (G_timeframe_220 == 0) timeframe_12 = 5;
if (G_timeframe_220 == PERIOD_M1) timeframe_12 = 15;
if (G_timeframe_220 == 2) timeframe_12 = 30;
if (G_timeframe_220 == 3) timeframe_12 = 60;
if (G_timeframe_220 == 4) timeframe_12 = 240;
if (G_timeframe_220 == PERIOD_M5) timeframe_12 = 10080;
if (G_timeframe_220 == 6) timeframe_12 = 43200;
int Li_unused_16 = Gi_224;
if (Gi_224 == 0) Li_unused_16 = 5;
if (Gi_224 == 1) Li_unused_16 = 15;
if (Gi_224 == 2) Li_unused_16 = 30;
if (Gi_224 == 3) Li_unused_16 = 60;
if (Gi_224 == 4) Li_unused_16 = 240;
if (Gi_224 == 5) Li_unused_16 = 10080;
if (Gi_224 == 6) Li_unused_16 = 43200;
double istochastic_20 = iStochastic(NULL, timeframe_0, S1_IS_1, S1_IS_2, S1_IS_3, MODE_SMA, 0, MODE_MAIN, G_shift_268);
double iadx_28 = iADX(NULL, timeframe_4, S1_ADX_1, PRICE_CLOSE, MODE_PLUSDI, Gi_272);
double iadx_36 = iADX(NULL, timeframe_4, S1_ADX_1, PRICE_CLOSE, MODE_MINUSDI, Gi_276);
double icci_44 = iCCI(NULL, timeframe_8, S1_CCI, PRICE_CLOSE, Gi_280);
if (iOpen(Symbol(), timeframe_12, 3) - iClose(Symbol(), timeframe_12, 0) >= S1_dig1 && istochastic_20 >= S1_SHC && iadx_28 < iadx_36 && icci_44 >= 30.0) return (1);
return (0.0);
}

void OpenBuyOrder() {
int Li_0 = 1;
if (Additional_Decimals == TRUE) Li_0 = 10 * Li_0;
double price_4 = 0;
double price_12 = 0;
price_4 = 0;
if (!openPositions()) {
if (StopLoss > 0) price_4 = Ask - StopLoss * Point * Li_0;
price_12 = 0;
if (TakeProfit > 0) price_12 = Ask + TakeProfit * Point * Li_0;
OrderSend(Symbol(), OP_BUY, LotsOptimized(), Ask, G_slippage_284, price_4, price_12, "", MAGIC, 0, Green);
prtAlert("EA_High-Profits_EUR-USD : OpenBuy for " + DoubleToStr(Ask, 4));
}
}

void OpenSellOrder() {
int Li_0 = 1;
if (Additional_Decimals == TRUE) Li_0 = 10 * Li_0;
double price_4 = 0;
double price_12 = 0;
price_4 = 0;
if (!openPositions2()) {
if (StopLoss > 0) price_4 = Bid + StopLoss * Point * Li_0;
price_12 = 0;
if (TakeProfit > 0) price_12 = Bid - TakeProfit * Point * Li_0;
OrderSend(Symbol(), OP_SELL, LotsOptimized2(), Bid, G_slippage_284, price_4, price_12, "", MAGIC2, 0, Red);
prtAlert("EA_High-Profits_EUR-USD : OpenSell for " + DoubleToStr(Bid, 4));
}
}

void prtAlert(string As_0 = "") {
Print(Symbol() + " - " + As_0);
Alert(Symbol() + " - " + As_0);
}

bool openPositions() {
int count_0 = 0;
for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == MAGIC) {
if (OrderSymbol() == Symbol())
if (OrderType() == OP_BUY) count_0++;
}
}
return (count_0);
}

bool openPositions2() {
int count_0 = 0;
for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == MAGIC2) {
if (OrderSymbol() == Symbol())
if (OrderType() == OP_SELL) count_0++;
}
}
return (count_0);
}

int start() {
if (Symbol() != "EURUSD" && Symbol() != "EURUSDm") return;
//if ((TimeDay(TimeCurrent()) > 25 && TimeMonth(TimeCurrent()) >= 3 && TimeYear(TimeCurrent()) >= 2010) || (TimeMonth(TimeCurrent()) > 3 && TimeYear(TimeCurrent()) >= 2010) ||
// TimeYear(TimeCurrent()) > 2010) {
// Comment("===Time of the EA_High-Profits_EUR-USD has EXPIRED===");
// Print("===Time of the EA_High-Profits_EUR-USD has EXPIRED===");
// return;
//}
if (AccountFreeMargin() < 1000.0 * LotsOptimized())
if (AccountFreeMargin() < 1000.0 * LotsOptimized2()) return (0);
if (BUY() == 1.0) OpenBuyOrder();
if (SELL() == 1.0) OpenSellOrder();
return (0);
}

double LotsOptimized() {
double Ld_ret_0 = Lots;
int hist_total_8 = OrdersHistoryTotal();
int count_12 = 0;
Ld_ret_0 = NormalizeDouble(AccountFreeMargin() * MaximumRisk / 1000.0, 1);
if (Use_EAs_Management == TRUE) Ld_ret_0 = NormalizeDouble(AccountBalance() / Quantity_EAs * MaximumRisk / 1000.0, 1);
if (Use_EAs_Management == TRUE && Account_Mini == TRUE) Ld_ret_0 = 10.0 * NormalizeDouble(AccountBalance() / Quantity_EAs * MaximumRisk / 1000.0, 1);
if (Use_EAs_Management == TRUE && Account_Micro == TRUE) Ld_ret_0 = 100.0 * NormalizeDouble(AccountBalance() / Quantity_EAs * MaximumRisk / 1000.0, 1);
if (DecreaseFactor > 0.0) {
for (int pos_16 = hist_total_8 - 1; pos_16 >= 0; pos_16--) {
if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY) == FALSE) {
Print("Error in history!");
break;
}
if (OrderSymbol() != Symbol() || OrderType() > OP_SELL || OrderMagicNumber() != MAGIC) continue;
if (OrderProfit() > 0.0) break;
if (OrderProfit() < 0.0 && OrderMagicNumber() == MAGIC) count_12++;
}
if (count_12 > 2) Ld_ret_0 = NormalizeDouble(Ld_ret_0 - Ld_ret_0 * count_12 / DecreaseFactor, 1);
}
if (Ld_ret_0 < 0.1) Ld_ret_0 = 0.1;
if (Use_Money_Management == FALSE) Ld_ret_0 = Lots;
if (Ld_ret_0 > MaxLots) Ld_ret_0 = MaxLots;
return (Ld_ret_0);
}

double LotsOptimized2() {
double Ld_ret_0 = Lots;
int hist_total_8 = OrdersHistoryTotal();
int count_12 = 0;
Ld_ret_0 = NormalizeDouble(AccountFreeMargin() * MaximumRisk / 1000.0, 1);
if (Use_EAs_Management == TRUE) Ld_ret_0 = NormalizeDouble(AccountBalance() / Quantity_EAs * MaximumRisk / 1000.0, 1);
if (Use_EAs_Management == TRUE && Account_Mini == TRUE) Ld_ret_0 = 10.0 * NormalizeDouble(AccountBalance() / Quantity_EAs * MaximumRisk / 1000.0, 1);
if (Use_EAs_Management == TRUE && Account_Micro == TRUE) Ld_ret_0 = 100.0 * NormalizeDouble(AccountBalance() / Quantity_EAs * MaximumRisk / 1000.0, 1);
if (DecreaseFactor > 0.0) {
for (int pos_16 = hist_total_8 - 1; pos_16 >= 0; pos_16--) {
if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY) == FALSE) {
Print("Error in history!");
break;
}
if (OrderSymbol() != Symbol() || OrderType() > OP_SELL || OrderMagicNumber() != MAGIC2) continue;
if (OrderProfit() > 0.0) break;
if (OrderProfit() < 0.0 && OrderMagicNumber() == MAGIC2) count_12++;
}
if (count_12 > 2) Ld_ret_0 = NormalizeDouble(Ld_ret_0 - Ld_ret_0 * count_12 / DecreaseFactor, 1);
}
if (Ld_ret_0 < 0.1) Ld_ret_0 = 0.1;
if (Use_Money_Management == FALSE) Ld_ret_0 = Lots;
if (Ld_ret_0 > MaxLots) Ld_ret_0 = MaxLots;
return (Ld_ret_0);
}

相关资源

暂无评论

暂无评论...