/*
Generated by EX4-TO-MQ4 decompiler V4.0.427.4 [-]
Website: https://purebeam.biz
E-mail : purebeam@gmail.com
2012-10-04 by Capella at http://www.worldwide-invest.org
- Licence commented out
- Removed unused variables
*/
#property copyright "Copyright � 2012, Forex Auto Millions"
#property link "http://www.forexautomillions.com"
//#include <stdlib.mqh>
#import "stdlib.ex4"
string ErrorDescription(int a0);
#import
extern string Validation = "== License Information ==";
//extern int License = 12345;
extern string Broker = "== Broker ==";
extern bool DisplayComments = FALSE;
extern string ExpertName = "Forex Auto Millions 300";
extern int MagicNumber = 12345;
extern int MaxSpread = 4;
extern int MaxSlippage = 4;
extern int GMTOFFSET = 0;
extern string Manage = "== Order Management ==";
extern int OpenOrdersLimit = 1;
extern bool Monday = TRUE;
extern bool Tuesday = TRUE;
extern bool Wednesday = TRUE;
extern bool Thursday = TRUE;
extern bool Friday = TRUE;
extern int StopLoss = 300;
extern int TakeProfit = 1000;
extern double Lots = 1.0;
extern double LotsBoost = 0.0;
extern double MaxLots = 1000.0;
extern bool LotsReset = FALSE;
extern bool Trail = TRUE;
extern int TrailingStop = 3;
extern int TrailingGap = 0;
double gd_204 = 1.0;
bool gi_212 = FALSE;
int g_digits_224 = 4;
int g_time_236 = 0;
int g_time_240 = 0;
double gd_244 = 1.0;
int g_day_of_week_284 = -1;
int g_day_of_week_292 = -1;
int g_day_of_week_296 = -1;
int g_day_of_week_300 = -1;
int gi_unused_304 = -1;
int gi_unused_308 = -1;
int g_day_of_week_312 = -1;
int g_day_of_week_328 = -1;
int g_day_of_week_332 = -1;
int init() {
g_digits_224 = Digits;
gd_244 = Lots;
Comment("");
return (0);
}
int start() {
/*
int li_0 = AccountNumber() * 2 + 170 + 29;
if (License != li_0) {
Alert("Wrong license!");
return (0);
}
*/
if (Bars < 10) {
Comment("Not enough bars");
return (0);
}
if (gi_212 == TRUE) {
Comment("EA Terminated.");
return (0);
}
f0_11();
return (0);
}
void f0_11() {
if (g_digits_224 == 3 || g_digits_224 == 5 && 1) gd_204 = 10;
f0_14();
f0_4();
f0_8();
}
void f0_8() {
double order_profit_0;
int datetime_8;
int hist_total_12;
double ld_20;
int datetime_28;
int li_32;
if (DisplayComments == TRUE) {
order_profit_0 = 0;
datetime_8 = 0;
hist_total_12 = OrdersHistoryTotal();
for (int pos_16 = 0; pos_16 < hist_total_12; pos_16++) {
if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && datetime_8 < OrderCloseTime()) {
datetime_8 = OrderCloseTime();
order_profit_0 = OrderProfit();
gd_244 = OrderLots();
}
}
}
if (order_profit_0 > 0.0) {
gd_244 = 1.0 * gd_244 + LotsBoost;
if (LotsReset) gd_244 = Lots;
} else {
if (order_profit_0 < 0.0) {
gd_244 = 1.0 * gd_244 + LotsBoost;
if (LotsReset) gd_244 = Lots;
}
}
if (gd_244 > MaxLots) gd_244 = MaxLots;
ld_20 = gd_244;
if (ld_20 < MarketInfo(Symbol(), MODE_MINLOT)) ld_20 = MarketInfo(Symbol(), MODE_MINLOT);
if (ld_20 > MarketInfo(Symbol(), MODE_MAXLOT)) ld_20 = MarketInfo(Symbol(), MODE_MAXLOT);
datetime_28 = TimeCurrent();
li_32 = TimeCurrent();
li_32 += 3600 * GMTOFFSET;
Comment("EA Licensed to:" + AccountName()
+ "\n"
+ "Account Number:" + AccountNumber()
+ "\n"
+ "Account Balance:" + DoubleToStr(AccountBalance(), Point)
+ "\n"
+ "Lot Size is " + Symbol() + " is " + ld_20
+ "\n"
+ "Greenwich Mean Time (GMT) now should be " + TimeHour(li_32), ":", TimeMinute(li_32)
+ "\n"
+ "GMT time difference from your broker is set to " + GMTOFFSET + ". Please ensure the GMT above is correct"
+ "\n"
+ "If the GMT time is not correct then adjust the GMT offset"
+ "\n"
+ "Trailing Stop for " + Symbol() + " is " + TrailingStop
+ "\n"
+ "Minimum Trailing Stop for " + Symbol() + " plus spread is " + ((MarketInfo(Symbol(), MODE_STOPLEVEL) / gd_204 + 13 / gd_204))
+ "\n"
+ "The EA must only be used on the EURUSD m15 chart"
+ "\n"
+ "Copyright � 2012, Forex Auto Millions"
+ "\n"
+ "http://www.forexautomillions.com/"
+ "\n"
+ "support@forexautomillions.com");
}
}
void f0_14() {
if ((Monday && DayOfWeek() == 1) || (Tuesday && DayOfWeek() == 2) || (Wednesday && DayOfWeek() == 3) || (Thursday && DayOfWeek() == 4) || (Friday && DayOfWeek() == 5) ||
(DayOfWeek() == 6 && 0) || (DayOfWeek() == 0 && 0)) {
f0_19();
f0_9();
f0_18();
f0_6();
f0_12();
f0_3();
f0_13();
}
}
int f0_7() {
int datetime_0 = TimeCurrent();
return (datetime_0 + 3600 * GMTOFFSET);
}
void f0_19() {
int li_0 = f0_7();
if (TimeHour(li_0) == 5) {
if (TimeMinute(li_0) == 13) {
if (DayOfWeek() != g_day_of_week_284) {
g_day_of_week_284 = DayOfWeek();
f0_0();
}
}
}
}
void f0_9() {
int li_0 = f0_7();
if (TimeHour(li_0) == 23) {
if (TimeMinute(li_0) == 22) {
if (DayOfWeek() != g_day_of_week_292) {
g_day_of_week_292 = DayOfWeek();
f0_0();
}
}
}
}
void f0_18() {
int li_0 = f0_7();
if (TimeHour(li_0) == 14) {
if (TimeMinute(li_0) == 14) {
if (DayOfWeek() != g_day_of_week_296) {
g_day_of_week_296 = DayOfWeek();
f0_0();
}
}
}
}
void f0_6() {
int li_0 = f0_7();
if (TimeHour(li_0) == 19) {
if (TimeMinute(li_0) == 23) {
if (DayOfWeek() != g_day_of_week_300) {
g_day_of_week_300 = DayOfWeek();
f0_0();
}
}
}
}
void f0_12() {
int li_0 = f0_7();
if (TimeHour(li_0) == 9) {
if (TimeMinute(li_0) == 48) {
if (DayOfWeek() != g_day_of_week_312) {
g_day_of_week_312 = DayOfWeek();
f0_2();
}
}
}
}
void f0_3() {
int li_0 = f0_7();
if (TimeHour(li_0) == 9) {
if (TimeMinute(li_0) == 48) {
if (DayOfWeek() != g_day_of_week_328) {
g_day_of_week_328 = DayOfWeek();
f0_2();
}
}
}
}
void f0_13() {
int li_0 = f0_7();
if (TimeHour(li_0) == 19) {
if (TimeMinute(li_0) == 41) {
if (DayOfWeek() != g_day_of_week_332) {
g_day_of_week_332 = DayOfWeek();
f0_2();
}
}
}
}
void f0_0() {
if (Low[0] > iMA(NULL, 0, 7, 0, MODE_SMA, PRICE_CLOSE, 0) && iMA(NULL, 0, 7, 0, MODE_SMA, PRICE_CLOSE, 0) > iMA(NULL, 0, 14, 0, MODE_SMA, PRICE_CLOSE, 0)) f0_16();
}
void f0_2() {
if (High[0] < iMA(NULL, 0, 7, 0, MODE_SMA, PRICE_CLOSE, 0) && iMA(NULL, 0, 7, 0, MODE_SMA, PRICE_CLOSE, 0) < iMA(NULL, 0, 14, 0, MODE_SMA, PRICE_CLOSE, 0)) f0_17();
}
void f0_16() {
if (g_time_236 < Time[0]) {
g_time_236 = Time[0];
f0_10();
}
}
void f0_10() {
int count_0 = 0;
for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol())
if (OrderMagicNumber() == MagicNumber) count_0++;
} else Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
if (count_0 < OpenOrdersLimit) f0_1();
}
void f0_17() {
if (g_time_240 < Time[0]) {
g_time_240 = Time[0];
f0_15();
}
}
void f0_15() {
int count_0 = 0;
for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol())
if (OrderMagicNumber() == MagicNumber) count_0++;
} else Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
if (count_0 < OpenOrdersLimit) f0_5();
}
void f0_1() {
bool bool_48;
double order_profit_0 = 0;
int datetime_8 = 0;
int hist_total_12 = OrdersHistoryTotal();
for (int pos_16 = 0; pos_16 < hist_total_12; pos_16++) {
if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && datetime_8 < OrderCloseTime()) {
datetime_8 = OrderCloseTime();
order_profit_0 = OrderProfit();
gd_244 = OrderLots();
}
}
}
if (order_profit_0 > 0.0) {
gd_244 = 1.0 * gd_244 + LotsBoost;
if (LotsReset) gd_244 = Lots;
} else {
if (order_profit_0 < 0.0) {
gd_244 = 1.0 * gd_244 + LotsBoost;
if (LotsReset) gd_244 = Lots;
}
}
if (gd_244 > MaxLots) gd_244 = MaxLots;
double lots_20 = gd_244;
if (lots_20 < MarketInfo(Symbol(), MODE_MINLOT)) lots_20 = MarketInfo(Symbol(), MODE_MINLOT);
if (lots_20 > MarketInfo(Symbol(), MODE_MAXLOT)) lots_20 = MarketInfo(Symbol(), MODE_MAXLOT);
double price_28 = Ask - StopLoss * gd_204 * Point;
if (StopLoss == 0) price_28 = 0;
double price_36 = Ask + TakeProfit * gd_204 * Point;
if (TakeProfit == 0) price_36 = 0;
int ticket_44 = -1;
ticket_44 = OrderSend(Symbol(), OP_BUY, lots_20, Ask, 4, 0, 0, ExpertName, MagicNumber, 0, Blue);
if (ticket_44 > -1) {
OrderSelect(ticket_44, SELECT_BY_TICKET);
bool_48 = OrderModify(OrderTicket(), OrderOpenPrice(), price_28, price_36, 0, Blue);
if (bool_48 == FALSE) Print("OrderModify() error - ", ErrorDescription(GetLastError()));
} else Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
void f0_5() {
bool bool_48;
double order_profit_0 = 0;
int datetime_8 = 0;
int hist_total_12 = OrdersHistoryTotal();
for (int pos_16 = 0; pos_16 < hist_total_12; pos_16++) {
if (OrderSelect(pos_16, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber && datetime_8 < OrderCloseTime()) {
datetime_8 = OrderCloseTime();
order_profit_0 = OrderProfit();
gd_244 = OrderLots();
}
}
}
if (order_profit_0 > 0.0) {
gd_244 = 1.0 * gd_244 + LotsBoost;
if (LotsReset) gd_244 = Lots;
} else {
if (order_profit_0 < 0.0) {
gd_244 = 1.0 * gd_244 + LotsBoost;
if (LotsReset) gd_244 = Lots;
}
}
if (gd_244 > MaxLots) gd_244 = MaxLots;
double lots_20 = gd_244;
if (lots_20 < MarketInfo(Symbol(), MODE_MINLOT)) lots_20 = MarketInfo(Symbol(), MODE_MINLOT);
if (lots_20 > MarketInfo(Symbol(), MODE_MAXLOT)) lots_20 = MarketInfo(Symbol(), MODE_MAXLOT);
double price_28 = Bid + StopLoss * gd_204 * Point;
if (StopLoss == 0) price_28 = 0;
double price_36 = Bid - TakeProfit * gd_204 * Point;
if (TakeProfit == 0) price_36 = 0;
int ticket_44 = -1;
ticket_44 = OrderSend(Symbol(), OP_SELL, lots_20, Bid, 4, 0, 0, ExpertName, MagicNumber, 0, Red);
if (ticket_44 > -1) {
OrderSelect(ticket_44, SELECT_BY_TICKET);
bool_48 = OrderModify(OrderTicket(), OrderOpenPrice(), price_28, price_36, 0, Red);
if (bool_48 == FALSE) Print("OrderModify() error - ", ErrorDescription(GetLastError()));
} else Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
void f0_4() {
double order_takeprofit_4;
bool bool_12;
bool bool_16;
if (Trail == TRUE) {
for (int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) {
if (OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES)) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
order_takeprofit_4 = OrderTakeProfit();
if (TrailingStop < MarketInfo(Symbol(), MODE_STOPLEVEL) / gd_204 + MarketInfo(Symbol(), MODE_SPREAD) / gd_204 + 1.0) TrailingStop = MarketInfo(Symbol(), MODE_STOPLEVEL) / gd_204 + MarketInfo(Symbol(), MODE_SPREAD) / gd_204 + 1.0;
if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > TrailingStop * gd_204 * Point) {
if (OrderStopLoss() < Ask - (TrailingStop + TrailingGap) * gd_204 * Point) {
bool_12 = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - TrailingStop * gd_204 * Point, order_takeprofit_4, OrderExpiration(), White);
if (bool_12 == FALSE) Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > TrailingStop * gd_204 * Point) {
if (OrderStopLoss() > Bid + (TrailingStop + TrailingGap) * gd_204 * Point) {
bool_16 = OrderModify(OrderTicket(), OrderOpenPrice(), Bid + TrailingStop * gd_204 * Point, order_takeprofit_4, OrderExpiration(), White);
if (bool_16 == FALSE) Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
}
} else Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
}
}
int deinit() {
return (0);
}