extern string comment = \"TDS\";
extern int magic = 1234;
extern string moneymanagement = \"Money Management\";
extern double lots = 0.01;
extern bool lotsoptimized = TRUE;
extern double risk = 1.0;
extern double minlot = 0.01;
extern double maxlot = 10.0;
extern double lotdigits = 2.0;
extern bool basketpercent = FALSE;
extern double profit = 10.0;
extern double loss = 30.0;
extern string ordersmanagement = \"Order Management\";
extern bool oppositeclose = TRUE;
extern bool reversesignals = FALSE;
extern int maxtrades = 100;
extern int tradesperbar = 1;
extern bool hidestop = FALSE;
extern bool hidetarget = TRUE;
extern int buystop = 0;
extern int buytarget = 11;
extern int sellstop = 0;
extern int selltarget = 11;
extern int trailingstart = 0;
extern int trailingstop = 0;
extern int trailingstep = 1;
extern int breakevengain = 0;
extern int breakeven = 0;
extern int slippage = 5;
extern string entrylogics = \"Entry Logics\";
extern int shift = 1;
extern bool timeframe1 = TRUE;
extern int timeframe1period = 3;
extern bool timeframe5 = FALSE;
extern int timeframe5period = 12;
extern bool timeframe15 = FALSE;
extern int timeframe15period = 12;
extern bool timeframe30 = FALSE;
extern int timeframe30period = 12;
extern bool timeframe60 = FALSE;
extern int timeframe60period = 12;
extern bool timeframe240 = TRUE;
extern int timeframe240period = 12;
extern bool timeframe1440 = TRUE;
extern int timeframe1440period = 10;
extern bool timeframe10080 = FALSE;
extern int timeframe10080period = 12;
extern string timefilter = \"Time Filter\";
extern int gmtshift = 1;
extern bool tradesunday = FALSE;
extern bool mondayfilter = TRUE;
extern int mondaystart = 14;
extern bool fridayfilter = FALSE;
extern int fridayend = 24;
extern string volatilityfilters = \"Volatility Filter\";
extern bool timeframe1vfilter = FALSE;
extern bool timeframe5vfilter = FALSE;
extern bool timeframe15vfilter = FALSE;
extern bool timeframe30vfilter = FALSE;
extern bool timeframe60vfilter = FALSE;
extern bool timeframe240vfilter = TRUE;
extern bool timeframe1440vfilter = TRUE;
extern bool timeframe10080vfilter = FALSE;
extern string otherfilters = \"Other Filters\";
extern bool pricefilter = TRUE;
extern bool patternsfilter = TRUE;
datetime gt_unused_396;
datetime gt_unused_400;
int g_datetime_404;
int g_datetime_408;
double gd_412 = 0.0;
double g_ord_open_price_420 = 0.0;
double g_ord_open_price_428 = 0.0;
double g_price_436;
double g_price_444;
double gd_452;
double gd_460;
double gd_484;
double gd_492;
int g_pos_500;
int g_pos_504;
int g_pos_508;
int g_pos_512;
int g_digits_516;
int g_bars_520 = -1;
int g_count_524 = 0;
int g_ord_total_528;
int g_ticket_532;
int gi_536 = 0;
int gi_540 = 0;
int gi_544 = 0;
int gi_unused_548 = 0;
int gi_unused_552 = 0;
int g_pos_556 = 0;
int init() {
gt_unused_396 = Time[0];
gt_unused_400 = Time[0];
g_digits_516 = Digits;
if (g_digits_516 == 3 || g_digits_516 == 5) {
gd_452 = 10.0 * Point;
gd_460 = 10;
} else {
gd_452 = Point;
gd_460 = 1;
}
return (0);
}
int start() {
double ld_8;
double ld_16;
Comment(\"n THE DONCHIAN SCALPER\",
g_ord_total_528 = OrdersTotal();
if (breakevengain > 0) {
for (int l_pos_0 = 0; l_pos_0 < g_ord_total_528; l_pos_0++) {
OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES);
if (OrderType() = NormalizeDouble(breakeven * gd_452, g_digits_516)) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice() + breakeven * gd_452, g_digits_516), OrderTakeProfit(), 0, Blue);
return (0);
}
if (NormalizeDouble(OrderOpenPrice() - Ask, g_digits_516) >= NormalizeDouble(breakevengain * gd_452, g_digits_516)) {
if (NormalizeDouble(OrderOpenPrice() - OrderStopLoss(), g_digits_516) < NormalizeDouble(breakeven * gd_452, g_digits_516)) {
OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(OrderOpenPrice() - breakeven * gd_452, g_digits_516), OrderTakeProfit(), 0, Red);
return (0);
}
}
}
}
}
if (trailingstop > 0) {
for (int l_pos_4 = 0; l_pos_4 < g_ord_total_528; l_pos_4++) {
OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES);
if (OrderType() NormalizeDouble(OrderOpenPrice() + trailingstart * gd_452, g_digits_516) && NormalizeDouble(OrderStopLoss(), g_digits_516) < NormalizeDouble(Bid - (trailingstop +
trailingstep) * gd_452, g_digits_516) || OrderStopLoss() == 0.0)) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(Bid - trailingstop * gd_452, g_digits_516), OrderTakeProfit(), 0, Blue);
return (0);
}
if (NormalizeDouble(Bid, g_digits_516) < NormalizeDouble(OrderOpenPrice() - trailingstart * gd_452, g_digits_516) && NormalizeDouble(OrderStopLoss(), g_digits_516) > NormalizeDouble(Ask +
(trailingstop + trailingstep) * gd_452, g_digits_516) || OrderStopLoss() == 0.0) {
OrderModify(OrderTicket(), OrderOpenPrice(), NormalizeDouble(Ask + trailingstop * gd_452, g_digits_516), OrderTakeProfit(), 0, Red);
return (0);
}
}
}
}
if (basketpercent) {
ld_8 = profit * (AccountBalance() / 100.0);
ld_16 = loss * (AccountBalance() / 100.0);
gd_412 = AccountEquity() - AccountBalance();
if (gd_412 > gd_484) gd_484 = gd_412;
if (gd_412 < gd_492) gd_492 = gd_412;
if (gd_412 >= ld_8 || gd_412 = 0; g_pos_500--) {
OrderSelect(g_pos_500, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic && OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, slippage * gd_452);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic && OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, slippage * gd_452);
}
return (0);
}
}
for (g_pos_556 = 0; g_pos_556 < OrdersTotal(); g_pos_556++) {
OrderSelect(g_pos_556, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == magic && OrderCloseTime() == 0) {
gi_544++;
if (OrderType() == OP_BUY) {
gi_536++;
g_ord_open_price_420 = OrderOpenPrice();
gi_unused_548 = OrderProfit();
g_datetime_404 = OrderOpenTime();
}
if (OrderType() == OP_SELL) {
gi_540++;
g_ord_open_price_428 = OrderOpenPrice();
gi_unused_552 = OrderProfit();
g_datetime_408 = OrderOpenTime();
}
}
}
double l_ihigh_24 = iHigh(Symbol(), PERIOD_M1, iHighest(Symbol(), PERIOD_M1, MODE_HIGH, timeframe1period, shift + 1));
double l_ilow_32 = iLow(Symbol(), PERIOD_M1, iLowest(Symbol(), PERIOD_M1, MODE_LOW, timeframe1period, shift + 1));
double l_ihigh_40 = iHigh(Symbol(), PERIOD_M1, iHighest(Symbol(), PERIOD_M1, MODE_HIGH, timeframe1period, shift));
double l_ilow_48 = iLow(Symbol(), PERIOD_M1, iLowest(Symbol(), PERIOD_M1, MODE_LOW, timeframe1period, shift));
double l_ihigh_56 = iHigh(Symbol(), PERIOD_M5, iHighest(Symbol(), PERIOD_M5, MODE_HIGH, timeframe5period, shift + 1));
double l_ilow_64 = iLow(Symbol(), PERIOD_M5, iLowest(Symbol(), PERIOD_M5, MODE_LOW, timeframe5period, shift + 1));
double l_ihigh_72 = iHigh(Symbol(), PERIOD_M5, iHighest(Symbol(), PERIOD_M5, MODE_HIGH, timeframe5period, shift));
double l_ilow_80 = iLow(Symbol(), PERIOD_M5, iLowest(Symbol(), PERIOD_M5, MODE_LOW, timeframe5period, shift));
double l_ihigh_88 = iHigh(Symbol(), PERIOD_M15, iHighest(Symbol(), PERIOD_M15, MODE_HIGH, timeframe15period, shift + 1));
double l_ilow_96 = iLow(Symbol(), PERIOD_M15, iLowest(Symbol(), PERIOD_M15, MODE_LOW, timeframe15period, shift + 1));
double l_ihigh_104 = iHigh(Symbol(), PERIOD_M15, iHighest(Symbol(), PERIOD_M15, MODE_HIGH, timeframe15period, shift));
double l_ilow_112 = iLow(Symbol(), PERIOD_M15, iLowest(Symbol(), PERIOD_M15, MODE_LOW, timeframe15period, shift));
double l_ihigh_120 = iHigh(Symbol(), PERIOD_M30, iHighest(Symbol(), PERIOD_M30, MODE_HIGH, timeframe30period, shift + 1));
double l_ilow_128 = iLow(Symbol(), PERIOD_M30, iLowest(Symbol(), PERIOD_M30, MODE_LOW, timeframe30period, shift + 1));
double l_ihigh_136 = iHigh(Symbol(), PERIOD_M30, iHighest(Symbol(), PERIOD_M30, MODE_HIGH, timeframe30period, shift));
double l_ilow_144 = iLow(Symbol(), PERIOD_M30, iLowest(Symbol(), PERIOD_M30, MODE_LOW, timeframe30period, shift));
double l_ihigh_152 = iHigh(Symbol(), PERIOD_H1, iHighest(Symbol(), PERIOD_H1, MODE_HIGH, timeframe60period, shift + 1));
double l_ilow_160 = iLow(Symbol(), PERIOD_H1, iLowest(Symbol(), PERIOD_H1, MODE_LOW, timeframe60period, shift + 1));
double l_ihigh_168 = iHigh(Symbol(), PERIOD_H1, iHighest(Symbol(), PERIOD_H1, MODE_HIGH, timeframe60period, shift));
double l_ilow_176 = iLow(Symbol(), PERIOD_H1, iLowest(Symbol(), PERIOD_H1, MODE_LOW, timeframe60period, shift));
double l_ihigh_184 = iHigh(Symbol(), PERIOD_H4, iHighest(Symbol(), PERIOD_H4, MODE_HIGH, timeframe240period, shift + 1));
double l_ilow_192 = iLow(Symbol(), PERIOD_H4, iLowest(Symbol(), PERIOD_H4, MODE_LOW, timeframe240period, shift + 1));
double l_ihigh_200 = iHigh(Symbol(), PERIOD_H4, iHighest(Symbol(), PERIOD_H4, MODE_HIGH, timeframe240period, shift));
double l_ilow_208 = iLow(Symbol(), PERIOD_H4, iLowest(Symbol(), PERIOD_H4, MODE_LOW, timeframe240period, shift));
double l_ihigh_216 = iHigh(Symbol(), PERIOD_D1, iHighest(Symbol(), PERIOD_D1, MODE_HIGH, timeframe1440period, shift + 1));
double l_ilow_224 = iLow(Symbol(), PERIOD_D1, iLowest(Symbol(), PERIOD_D1, MODE_LOW, timeframe1440period, shift + 1));
double l_ihigh_232 = iHigh(Symbol(), PERIOD_D1, iHighest(Symbol(), PERIOD_D1, MODE_HIGH, timeframe1440period, shift));
double l_ilow_240 = iLow(Symbol(), PERIOD_D1, iLowest(Symbol(), PERIOD_D1, MODE_LOW, timeframe1440period, shift));
double l_ihigh_248 = iHigh(Symbol(), PERIOD_W1, iHighest(Symbol(), PERIOD_W1, MODE_HIGH, timeframe10080period, shift + 1));
double l_ilow_256 = iLow(Symbol(), PERIOD_W1, iLowest(Symbol(), PERIOD_W1, MODE_LOW, timeframe10080period, shift + 1));
double l_ihigh_264 = iHigh(Symbol(), PERIOD_W1, iHighest(Symbol(), PERIOD_W1, MODE_HIGH, timeframe10080period, shift));
double l_ilow_272 = iLow(Symbol(), PERIOD_W1, iLowest(Symbol(), PERIOD_W1, MODE_LOW, timeframe10080period, shift));
bool li_280 = TRUE;
bool li_284 = TRUE;
bool li_288 = FALSE;
bool li_292 = FALSE;
if ((timeframe1vfilter && iBands(NULL, PERIOD_M1, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift) > iBands(NULL, PERIOD_M1, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift + 1) &&
iBands(NULL, PERIOD_M1, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift) < iBands(NULL, PERIOD_M1, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift + 1)) || (timeframe5vfilter && iBands(NULL, PERIOD_M5, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift) > iBands(NULL, PERIOD_M5, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift +
1) && iBands(NULL, PERIOD_M5, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift) < iBands(NULL, PERIOD_M5, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift + 1)) || (timeframe15vfilter &&
iBands(NULL, PERIOD_M15, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift) > iBands(NULL, PERIOD_M15, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift + 1) && iBands(NULL, PERIOD_M15, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift) < iBands(NULL, PERIOD_M15, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift +
1)) || (timeframe30vfilter && iBands(NULL, PERIOD_M30, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift) > iBands(NULL, PERIOD_M30, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift + 1) &&
iBands(NULL, PERIOD_M30, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift) < iBands(NULL, PERIOD_M30, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift + 1)) || (timeframe60vfilter && iBands(NULL, PERIOD_H1, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift) > iBands(NULL, PERIOD_H1, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift +
1) && iBands(NULL, PERIOD_H1, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift) < iBands(NULL, PERIOD_M15, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift + 1)) || (timeframe240vfilter &&
iBands(NULL, PERIOD_H4, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift) > iBands(NULL, PERIOD_H4, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift + 1) && iBands(NULL, PERIOD_H4, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift) < iBands(NULL, PERIOD_H4, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift +
1)) || (timeframe1440vfilter && iBands(NULL, PERIOD_D1, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift) > iBands(NULL, PERIOD_D1, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift + 1) &&
iBands(NULL, PERIOD_D1, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift) < iBands(NULL, PERIOD_D1, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift + 1)) || (timeframe10080vfilter && iBands(NULL, PERIOD_W1, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift) > iBands(NULL, PERIOD_W1, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, shift +
1) && iBands(NULL, PERIOD_W1, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift) < iBands(NULL, PERIOD_W1, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, shift + 1))) {
li_280 = FALSE;
li_284 = FALSE;
}
|