Code:
#import "C:\\MQ4Check.dll"
int getKey1();
#import
extern int Step = 200;
extern double FirstLot = 0.1;
extern double IncLot = 0.0;
extern double MinProfit = 18.0;
extern int Magic = 2010;
double g_ord_lots_108 = 0.0;
double g_ord_lots_116 = 0.0;
double gd_124;
double gd_132;
int gi_140 = 1635190;
int init() {
if (idCheck() != 1) {
Comment("try me");
GlobalVariableSet("OldBalance", AccountBalance());
return (0);
}
}
int deinit() {
if (idCheck() != 1) {
Comment("");
return (0);
}
}
int start() {
if (idCheck() != 1) {
if (AccountEquity() >= GlobalVariableGet("OldBalance") + MinProfit) {
DeletePendingOrders(Magic);
CloseOrders(Magic);
GlobalVariableSet("OldBalance", 0);
}
GlobalVariableSet("OldBalance", AccountBalance());
if (MyOrdersTotal(Magic) == 0) {
OrderSend(Symbol(), OP_BUYLIMIT, FirstLot, Ask - Step * Point, 3, 0, 0, "", Magic, 0, Green);
OrderSend(Symbol(), OP_SELLLIMIT, FirstLot, Bid + Step * Point, 3, 0, 0, "", Magic, 0, Red);
}
gd_124 = GetLastSellPrice(Magic);
gd_132 = GetLastBuyPrice(Magic);
if (gd_124 - Bid <= 5.0 * Point) OrderSend(Symbol(), OP_SELLLIMIT, g_ord_lots_108 + IncLot, gd_124 + Step * Point, 3, 0, 0, "", Magic, 0, Red);
if (Ask - gd_132 <= 5.0 * Point) OrderSend(Symbol(), OP_BUYLIMIT, g_ord_lots_116 + IncLot, gd_132 - Step * Point, 3, 0, 0, "", Magic, 0, Red);
}
return (0);
}
int DeletePendingOrders(int a_magic_0) {
int l_ord_total_4;
if (idCheck() != 1) {
l_ord_total_4 = OrdersTotal();
for (int l_pos_8 = l_ord_total_4 - 1; l_pos_8 >= 0; l_pos_8--) {
OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() != OP_BUY || OrderType() != OP_SELL) OrderDelete(OrderTicket());
}
}
return (0);
}
int CloseOrders(int a_magic_0) {
int l_ord_total_4;
if (idCheck() != 1) {
l_ord_total_4 = OrdersTotal();
for (int l_pos_8 = l_ord_total_4 - 1; l_pos_8 >= 0; l_pos_8--) {
OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol()) {
if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 3);
if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, 3);
}
}
}
return (0);
}
int MyOrdersTotal(int a_magic_0) {
int l_count_4;
int l_ord_total_8;
if (idCheck() != 1) {
l_count_4 = 0;
l_ord_total_8 = OrdersTotal();
for (int l_pos_12 = 0; l_pos_12 < l_ord_total_8; l_pos_12++) {
OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol()) l_count_4++;
}
}
return (l_count_4);
}
double GetLastBuyPrice(int a_magic_0) {
int li_4;
if (idCheck() != 1) {
li_4 = OrdersTotal() - 1;
for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) {
if (idCheck() == 1) return;
OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_BUYLIMIT || OrderType() == OP_BUY) {
g_ord_lots_116 = OrderLots();
return (OrderOpenPrice());
}
}
}
return (0);
}
double GetLastSellPrice(int a_magic_0) {
int li_4;
if (idCheck() != 1) {
li_4 = OrdersTotal() - 1;
for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) {
if (idCheck() == 1) return;
OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol() && OrderType() == OP_SELLLIMIT || OrderType() == OP_SELL) {
g_ord_lots_108 = OrderLots();
return (OrderOpenPrice());
}
}
}
return (100000);
}
int idCheck() {
if (gi_140 == gi_140) return (0);
return (1);
}
any tf,any curuncy,big trend will blow your account.