Aurix Exchange

can anyone get rid of the time restriction of this scalping EA

dexs2010

Member
This scalping EA expired on May 22,can anyone get rid of the time restriction.

This ea is a good steady profitable robot,only used on EURUSD M1.

thanks in advance.
 

r_a_u_l

Member
extern string EAÃ??Æ = "Money_Master_V3";
extern string ??Ç??æ?? = "110422";
extern string ÍøÖ? = "http://ryota7.taobao.com";
extern string ??Õß = "ÄÏ¿ÂÒ?ÃÎ QQ:45215454";
extern string starttime = "22:00";
extern string stoptime = "23:59";
extern int lever = 100;
extern int digit = 4;
extern double autopercent = 40.0;
extern double tp = 6.0;
extern double sl = 30.0;
double gd_156 = 2.0;
int gi_164 = 8;
int gi_168 = 10;
int gi_172 = 5;
int gi_176 = 3;
int gi_180 = 10;
int gi_184 = 60;
int gi_188 = 5;
extern double minlots = 0.01;
extern double maxlots = 0.0;
int gi_208 = 2;
extern string mondaystart = "04:00";
extern string fridayend = "20:00";
extern int Magic = 20110422;
int gi_232 = 0;
double gd_236;
double gd_244;
double gd_252 = 0.1;
double gd_260 = 0.0;
double gd_268 = 0.0;
double gd_276 = 0.0;
int gi_284 = 1;
double gd_288 = 0.0;
double gd_296 = 0.0;

int init() {
if (digit == 5) gi_284 = 10;
gi_232 *= gi_284;
tp *= gi_284;
sl *= gi_284;
gd_156 *= gi_284;
gi_164 *= gi_284;
gi_172 *= gi_284;
gi_176 *= gi_284;
gi_180 *= gi_284;
gd_260 = tp;
gd_268 = sl;
gd_276 = gi_164;
if (tp > MarketInfo(Symbol(), MODE_STOPLEVEL)) gd_260 = tp;
else gd_260 = MarketInfo(Symbol(), MODE_STOPLEVEL) + MarketInfo(Symbol(), MODE_FREEZELEVEL);
if (gi_164 > MarketInfo(Symbol(), MODE_STOPLEVEL)) gd_276 = gi_164;
else gd_276 = MarketInfo(Symbol(), MODE_STOPLEVEL) + MarketInfo(Symbol(), MODE_FREEZELEVEL);
Print("----MarketInfo(Symbol(),MODE_FREEZELEVEL):", MarketInfo(Symbol(), MODE_FREEZELEVEL));
Print("----MarketInfo(Symbol(),MODE_STOPLEVEL):", MarketInfo(Symbol(), MODE_STOPLEVEL));
return (0);
}

int deinit() {
if (ObjectFind("line1") != -1) ObjectDelete("line1");
for (int li_0 = 0; li_0 <= 0; li_0++) for (int li_4 = 1; li_4 <= 5; li_4++) ObjectDelete("txt" + li_0 + li_4);
if (ObjectFind("line2") != -1) ObjectDelete("line2");
return (0);
}

int start() {
/*if (!(TimeCurrent() >= 954374400) || !(TimeCurrent() <= 1305936000)) {
Alert("ÊÔÓÃÆÚÏÞÒÑ????Ç?ºÂòÕýÊ??æ QQ:45215454 ÍúÍú:ryota7");
return (0);
}*/
CloseForTP(Magic);
string ls_0 = "";
preStart();
draw();
TrailTp(gd_276);
VerifyTp(gd_276);
if (getOpenTimeSignal01() == 1) {
if (getBuySignal01()) {
ls_0 = "¿ª??";
while (IsTradeContextBusy() || !IsTradeAllowed()) Sleep(MathRand());
OrderTrade(Symbol(), OP_BUY, gd_252, gd_268, gd_260, Magic, ls_0);
return (0);
}
if (getSellSignal01()) {
ls_0 = "¿ª¿Õ";
while (IsTradeContextBusy() || !IsTradeAllowed()) Sleep(MathRand());
OrderTrade(Symbol(), OP_SELL, gd_252, gd_268, gd_260, Magic, ls_0);
return (0);
}
}
return (0);
}

int getOpenTimeSignal01() {
int li_0 = 0;
li_0 = IsInTimeS(starttime, stoptime);
if (TimeDayOfWeek(TimeCurrent()) == 5) {
if (IsInTimeS(fridayend, "24:00")) li_0 = 0;
} else {
if (TimeDayOfWeek(TimeCurrent()) == 1)
if (IsInTimeS("00:00", mondaystart)) li_0 = 0;
}
return (li_0);
}

bool getBuySignal01() {
bool li_0 = FALSE;
if (isKBStatus01() && isTBStatus01()) li_0 = TRUE;
return (li_0);
}

bool getSellSignal01() {
bool li_0 = FALSE;
if (isKSStatus01() && isTSStatus01()) li_0 = TRUE;
return (li_0);
}

int isKBStatus01() {
bool li_0 = FALSE;
if (gd_236 == 0.0) return (li_0);
if (Ask <= gd_236) li_0 = TRUE;
return (li_0);
}

int isKSStatus01() {
bool li_0 = FALSE;
if (gd_244 == 0.0) return (li_0);
if (Bid >= gd_244) li_0 = TRUE;
return (li_0);
}

int isTBStatus01() {
bool li_0 = FALSE;
if (IsInHisLossline(Magic)) return (0);
if (CheckTotalAll(Magic) < gi_208) {
if (CheckTotal(Magic, OP_BUY) == 0 && CheckHisTotalAll(Magic) == 0) return (1);
if (CheckTotal(Magic, OP_BUY) == 0 && CheckHisTotalAll(Magic) > 0) {
if (IsInHisLossline(Magic)) return (0);
return (1);
}
if (CheckTotal(Magic, OP_BUY) > 0) {
if (IsInHisLossline(Magic)) return (0);
if (IsInCurLossline(Magic, OP_BUY)) return (0);
return (1);
}
}
return (li_0);
}

int isTSStatus01() {
bool li_0 = FALSE;
if (IsInHisLossline(Magic)) return (0);
if (CheckTotalAll(Magic) < gi_208) {
if (CheckTotal(Magic, OP_SELL) == 0 && CheckHisTotalAll(Magic) == 0) return (1);
if (CheckTotal(Magic, OP_SELL) == 0 && CheckHisTotalAll(Magic) > 0) {
if (IsInHisLossline(Magic)) return (0);
return (1);
}
if (CheckTotal(Magic, OP_SELL) > 0) {
if (IsInHisLossline(Magic)) return (0);
if (IsInCurLossline(Magic, OP_SELL)) return (0);
return (1);
}
}
return (li_0);
}

bool IsInCurLossline(int ai_0 = 110316, int ai_4 = 0) {
if (gi_176 <= 0) return (FALSE);
if (gi_180 <= 0) return (FALSE);
bool li_8 = FALSE;
int li_12 = 0;
int li_16 = 0;
double ld_20 = 0;
for (int li_28 = OrdersTotal() - 1; li_28 >= 0; li_28--) {
if (OrderSelect(li_28, SELECT_BY_POS, MODE_TRADES))
if (OrderMagicNumber() == ai_0 && li_16 < OrderOpenTime() && OrderSymbol() == Symbol() && OrderType() == ai_4) li_16 = OrderOpenTime();
}
if (li_16 > 0) {
if ((TimeCurrent() - li_16) / 60 / Period() <= gi_168) li_8 = TRUE;
else li_8 = FALSE;
}
return (li_8);
}

bool IsInHisLossline(int ai_0 = 110316) {
if (gi_176 <= 0) return (FALSE);
if (gi_180 <= 0) return (FALSE);
bool li_4 = FALSE;
int li_8 = 0;
int li_12 = 0;
int li_16 = 0;
double ld_20 = 0;
int li_28 = 0;
double ld_32 = 0;
double ld_40 = 0;
for (int li_48 = OrdersHistoryTotal() - 1; li_48 >= 0; li_48--) {
if (OrderSelect(li_48, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderMagicNumber() == ai_0 && li_12 < OrderCloseTime() && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) {
li_12 = OrderCloseTime();
li_16 = OrderOpenTime();
ld_20 = OrderProfit();
li_28 = OrderTicket();
ld_32 = OrderOpenPrice();
ld_40 = OrderClosePrice();
}
}
}
if (li_12 > 0 && ld_20 < 0.0) {
if ((TimeCurrent() - li_12) / 60 / Period() <= gi_180 && (li_12 - li_16) / 60 / Period() <= gi_176 && MathAbs(ld_40 - ld_32) >= gi_172 * Point) li_4 = TRUE;
else li_4 = FALSE;
}
return (li_4);
}

void preStart() {
if (CheckTotalAll(Magic) == 0) gd_252 = getLots();
if ((Open[0] == High[0] && High[0] == Low[0]) || gd_288 != Low[0]) {
gd_288 = Low[0];
gd_236 = getBuyLine(gi_184, gi_188);
}
if ((Open[0] == High[0] && High[0] == Low[0]) || gd_296 != High[0]) {
gd_296 = High[0];
gd_244 = getSellLine(gi_184, gi_188);
}
}

double getLots() {
double ld_0 = 0.0;
double ld_8 = AccountEquity() * autopercent / 100.0;
ld_0 = ld_8 * lever / (100000.0 * Close[0]);
ld_0 = MathMax(ld_0, MarketInfo(Symbol(), MODE_MINLOT));
ld_0 = MathMin(ld_0, MarketInfo(Symbol(), MODE_MAXLOT));
if (maxlots != 0.0) ld_0 = MathMin(ld_0, maxlots);
if (minlots != 0.0) ld_0 = MathMax(ld_0, minlots);
if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.01) ld_0 = NormalizeDouble(ld_0, 2);
else
if (MarketInfo(Symbol(), MODE_LOTSTEP) == 0.1) ld_0 = NormalizeDouble(ld_0, 1);
return (ld_0);
}

double getBuyLine(int ai_0 = 60, int ai_4 = 5) {
double lda_16[];
if (ai_0 == 0) return (0);
if (ai_4 == 0) return (0);
if (ai_4 > ai_0) return (0);
double ld_8 = 0.0;
double ld_20 = 0;
ArrayResize(lda_16, ai_4);
ArrayInitialize(lda_16, 99999);
for (int li_28 = 0; li_28 < ai_0; li_28++) {
for (int li_32 = 0; li_32 < ai_4; li_32++) {
if (Low[li_28] < lda_16[li_32]) {
lda_16[li_32] = Low[li_28];
break;
}
}
}
for (li_32 = 0; li_32 < ai_4; li_32++) ld_20 += lda_16[li_32];
ld_8 = NormalizeDouble(ld_20 / ai_4, Digits);
ld_8 = ld_8 + MarketInfo(Symbol(), MODE_SPREAD) * Point + gd_156 * Point;
return (ld_8);
}

double getSellLine(int ai_0, int ai_4) {
double lda_16[];
if (ai_0 == 0) return (0);
if (ai_4 == 0) return (0);
if (ai_4 > ai_0) return (0);
double ld_8 = 0.0;
double ld_20 = 0;
ArrayResize(lda_16, ai_4);
ArrayInitialize(lda_16, 0);
for (int li_28 = 0; li_28 < ai_0; li_28++) {
for (int li_32 = 0; li_32 < ai_4; li_32++) {
if (High[li_28] > lda_16[li_32]) {
lda_16[li_32] = High[li_28];
break;
}
}
}
for (li_32 = 0; li_32 < ai_4; li_32++) ld_20 += lda_16[li_32];
ld_8 = NormalizeDouble(ld_20 / ai_4, Digits);
ld_8 -= gd_156 * Point;
return (ld_8);
}

void TrailTp(int ai_0) {
if (!IsExpertEnabled() && !IsTesting()) return;
if (ai_0 > MarketInfo(Symbol(), MODE_STOPLEVEL)) {
for (int li_4 = OrdersTotal() - 1; li_4 >= 0; li_4--) {
OrderSelect(li_4, SELECT_BY_POS);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) {
if (OrderType() == OP_BUY) {
if (OrderTakeProfit() == 0.0) {
while (IsTradeContextBusy() || !IsTradeAllowed()) Sleep(MathRand());
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Bid + ai_0 * Point, 0, Green);
continue;
}
if (OrderTakeProfit() - Bid > ai_0 * Point) {
while (IsTradeContextBusy() || !IsTradeAllowed()) Sleep(MathRand());
if (NormalizeDouble(OrderTakeProfit() - (Bid + ai_0 * Point), Digits) <= MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point / 2.0) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Bid + ai_0 * Point, 0, Green);
continue;
}
}
if (OrderType() == OP_SELL) {
if (OrderTakeProfit() == 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Ask - ai_0 * Point, 0, Green);
else {
if (Ask - OrderTakeProfit() > ai_0 * Point) {
while (IsTradeContextBusy() || !IsTradeAllowed()) Sleep(MathRand());
if (NormalizeDouble(Ask - ai_0 * Point, Digits) - OrderTakeProfit() > MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point / 2.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), Ask - ai_0 * Point, 0, Green);
}
}
}
}
}
}
}

void VerifyTp(int ai_0) {
int li_4 = 0;
if (!IsExpertEnabled() && !IsTesting()) return;
}

int CheckTotal(int ai_0, int ai_4) {
int li_8 = 0;
for (int li_12 = OrdersTotal() - 1; li_12 >= 0; li_12--) {
OrderSelect(li_12, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == ai_0 && OrderSymbol() == Symbol() && OrderType() == ai_4) li_8++;
}
return (li_8);
}

int CheckTotalAll(int ai_0) {
int li_4 = 0;
for (int li_8 = OrdersTotal() - 1; li_8 >= 0; li_8--) {
OrderSelect(li_8, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == ai_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) li_4++;
}
return (li_4);
}

int CheckHisTotalAll(int ai_0) {
int li_4 = 0;
for (int li_8 = OrdersHistoryTotal() - 1; li_8 >= 0; li_8--) {
OrderSelect(li_8, SELECT_BY_POS, MODE_HISTORY);
if (OrderMagicNumber() == ai_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL) li_4++;
}
return (li_4);
}

int OrderTrade(string as_0, int ai_8, double ad_12, int ai_20, int ai_24, int ai_28, string as_32) {
double ld_40 = 0;
double ld_48 = 0;
double ld_56 = 0;
RefreshRates();
color li_64 = Red;
switch (ai_8) {
case OP_BUY:
ld_40 = Ask - ai_20 * Point;
ld_48 = Ask + ai_24 * Point;
ld_56 = Ask;
li_64 = Blue;
break;
case OP_SELL:
ld_40 = Bid + ai_20 * Point;
ld_48 = Bid - ai_24 * Point;
ld_56 = Bid;
li_64 = Red;
break;
default:
return (-1);
}
if (ai_20 == 0) ld_40 = 0;
if (ai_24 == 0) ld_48 = 0;
if (ad_12 == 0.0) return (-1);
ld_56 = NormalizeDouble(ld_56, MarketInfo(Symbol(), MODE_DIGITS));
int li_72 = OrderSend(as_0, ai_8, ad_12, ld_56, 0, 0, 0, as_32, ai_28, 0, li_64);
if (li_72 > 0 && ai_20 + ai_24 > 0) OrderModify(li_72, OrderOpenPrice(), ld_40, ld_48, 0);
return (li_72);
}

void DrawLable(string as_0, string as_8, int ai_16, int ai_20, color ai_24) {
if (ObjectFind(as_0) != 0) ObjectDelete(as_0);
ObjectCreate(as_0, OBJ_LABEL, 0, 0, 0);
ObjectSetText(as_0, as_8, 10, "Verdana", ai_24);
ObjectSet(as_0, OBJPROP_CORNER, 0);
ObjectSet(as_0, OBJPROP_XDISTANCE, ai_16);
ObjectSet(as_0, OBJPROP_YDISTANCE, ai_20);
}

void draw() {
int li_0 = 0;
int li_4 = 10;
int li_8 = 20;
int li_12 = 0;
int li_16 = li_4 + 10;
int li_20 = li_8 - 15;
li_20 += 20;
DrawLable("txt01", "Money_Master_V3.110422", li_16, li_20, White);
li_20 += 20;
DrawLable("txt03", "¿ªÊ?Ê??ä?º" + starttime, li_16, li_20, White);
li_20 += 20;
DrawLable("txt04", "?áÊøÊ??ä?º" + stoptime, li_16, li_20, White);
li_20 += 20;
DrawLable("txt05", "ÏÂ??ÊÖÊý?º" + DoubleToStr(gd_252, 2), li_16, li_20, White);
}

int IsInTime(int ai_0 = 5, int ai_4 = 0, int ai_8 = 9, int ai_12 = 30) {
bool li_16 = FALSE;
int li_20 = TimeCurrent();
int li_24 = TimeHour(li_20);
int li_28 = TimeMinute(li_20);
if (ai_8 > ai_0) {
if (li_24 > ai_0 && li_24 < ai_8) li_16 = TRUE;
else {
if (li_24 == ai_0) {
if (li_28 >= ai_4) li_16 = TRUE;
else li_16 = FALSE;
} else {
if (li_24 == ai_8) {
if (li_28 <= ai_12) li_16 = TRUE;
else li_16 = FALSE;
}
}
}
} else {
if (ai_8 == ai_0) {
if (li_24 == ai_8 && li_28 >= ai_4 && li_28 <= ai_12) li_16 = TRUE;
else li_16 = FALSE;
} else {
if (ai_8 < ai_0) {
if (li_24 > ai_0 || li_24 < ai_8) li_16 = TRUE;
else {
if (li_24 == ai_0) {
if (li_28 >= ai_4) li_16 = TRUE;
else li_16 = FALSE;
}
}
if (li_24 == ai_8) {
if (li_28 <= ai_12) li_16 = TRUE;
else li_16 = FALSE;
}
}
}
}
return (li_16);
}

bool IsInTimeS(string as_0, string as_8) {
int li_16 = 0;
li_16 = IsInTime(TimeHour(StrToTime(as_0)), TimeMinute(StrToTime(as_0)), TimeHour(StrToTime(as_8)), TimeMinute(StrToTime(as_8)));
return (li_16);
}

void CloseForTP(int ai_0 = 110316) {
if (tp > MarketInfo(Symbol(), MODE_STOPLEVEL) && gi_164 > MarketInfo(Symbol(), MODE_STOPLEVEL)) return;
double ld_4 = 0;
double ld_12 = 0;
RefreshRates();
for (int li_20 = OrdersTotal() - 1; li_20 >= 0; li_20--) {
if (OrderSelect(li_20, SELECT_BY_POS, MODE_TRADES)) {
if (OrderMagicNumber() == ai_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUY || OrderType() == OP_SELL && OrderTakeProfit() != 0.0) {
ld_4 = 0;
ld_12 = 0;
if (OrderType() == OP_BUY) {
ld_4 = (OrderClosePrice() - OrderOpenPrice()) / Point;
ld_12 = (OrderTakeProfit() - OrderOpenPrice()) / Point;
if (tp < MarketInfo(Symbol(), MODE_STOPLEVEL) && OrderTakeProfit() - Bid > MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point) {
if (ld_4 >= tp) {
if (IsTradeAllowed() && !IsTradeContextBusy()) {
if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), 1, Green)) continue;
Alert("Æ??Ö??ÖÊ??Ü???íÎóÂ?º", GetLastError());
}
}
}
if (gi_164 < MarketInfo(Symbol(), MODE_STOPLEVEL)) {
if (Bid >= OrderTakeProfit() - (gd_276 - gi_164) * Point && OrderTakeProfit() - Bid > MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point) {
if (IsTradeAllowed() && !IsTradeContextBusy()) {
if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), 1, Green)) continue;
Alert("Æ??Ö??ÖÊ??Ü???íÎóÂ?º", GetLastError());
}
}
}
}
if (OrderType() == OP_SELL) {
ld_4 = (OrderOpenPrice() - Ask) / Point;
ld_12 = (OrderOpenPrice() - OrderTakeProfit()) / Point;
if (tp < MarketInfo(Symbol(), MODE_STOPLEVEL) && Ask - OrderTakeProfit() > MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point) {
if (ld_4 >= tp) {
if (IsTradeAllowed() && !IsTradeContextBusy()) {
if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), 0, Green)) continue;
Alert("Æ??Ö¿Õ?ÖÊ??Ü???íÎóÂ?º", GetLastError());
}
}
}
if (gi_164 < MarketInfo(Symbol(), MODE_STOPLEVEL)) {
if (Ask <= OrderTakeProfit() + (gd_276 - gi_164) * Point && Ask - OrderTakeProfit() > MarketInfo(Symbol(), MODE_FREEZELEVEL) * Point) {
if (IsTradeAllowed() && !IsTradeContextBusy())
if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), 0, Green) == 0) Alert("Æ??Ö¿Õ?ÖÊ??Ü???íÎóÂ?º", GetLastError());
}
}
}
}
}
}
}
 

dexs2010

Member
micscal,this ea works from gmt 20:00 to gmt 22:00.so you should adjust the set of starttime and endtime based on your broker's time.for example,my broker's time is gmt+2,so i set the starttime:22:00 and endtime:23:59
 

micscal

Member
strange...this is my result from 2010 to today. maybe something wrong on gmt offset? i use HotForex
 

Attachments

  • StrategyTester scalping.jpg
    StrategyTester scalping.jpg
    17.8 KB · Views: 0

Capella

Active member
VIP Member
what EA is it?

It's not a good idea to totally change the name of the EA's that we "crack" / "educate".

The name of this EA is "MoneyMaster" made by a Chinese guy with the property link...



Here is the "educated" version again, with its proper name.

 

Aurix Exchange
Top