/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : m@gmail.com[/email]
*/
#property copyright "www.aitrader.org ##黑金智能##"
#property link ""
extern string HeadLine = " www.aitrader.org";
extern string BuyBlock = "-------相疣戾蝠?蝾疸钼腓-------";
double gd_92 = 1.0;
extern int Profit = 35;
extern int gi_104 = 13;
double gd_108 = 1.0;
extern int gi_116 = 13;
extern string GeneralBlock = "-------吾?镟疣戾蝠?------";
extern int 间隔加码点数 = 10;
extern int Prosadka = 700;
extern int Povtor = 1;
int g_timeframe_140 = PERIOD_M1;
int g_timeframe_144 = PERIOD_M1;
bool gi_148 = FALSE;
int g_timeframe_152 = PERIOD_M15;
bool gi_156 = FALSE;
extern string Rez = "-------绣骅?------";
extern bool Extremal = TRUE;
extern bool Lentyaj = FALSE;
extern string EXTr = "-------相疣戾蝠?疱骅爨 菔岩信汤?------";
extern double LotSize = 0.01;
extern double LotExponent = 1.8;
extern int LotStep = 15000;
extern string OfficialVariable = "-------央箧遽睇?镥疱戾睇?------";
extern string InformationOnChartString = "InformationOnChart - 铗觌栩?潆 蝈耱屦?(玎戾潆弪)";
extern bool InformationOnChart = TRUE;
extern int MagicNumber = 123456789;
int g_datetime_228 = 0;
int g_datetime_232 = 0;
int gi_236 = 0;
int g_ticket_240;
int gi_244;
bool gi_248;
bool gi_252;
double g_lots_256;
double g_lots_264;
double g_lots_272;
double g_lots_280;
string g_comment_288;
string gs_296;
int init() {
gi_236 = LotDecimal();
if (Extremal) gi_156 = FALSE;
if (Extremal) gs_296 = "菔岩信汤?";
if (Lentyaj) gs_296 = "伺鸵呱";
if (Extremal == Lentyaj) gs_296 = "团 论列劳";
return (0);
}
int deinit() {
return (0);
}
int start() {
if (gi_236 == 0) gi_236 = LotDecimal();
Information();
if (Extremal != Lentyaj) {
gi_248 = TRUE;
gi_252 = TRUE;
}
if (g_datetime_228 != iTime(NULL, g_timeframe_140, 0)) {
g_ticket_240 = 0;
gi_244 = CountTrades("buy");
if (gi_244 == 0 && gi_248 == TRUE) {
g_comment_288 = "nishiwangge " + Symbol() + " - Buy " + ((gi_244 + 1));
g_lots_272 = NewLot("buy");
while (g_ticket_240 0 && NextOrder("buy")) {
g_comment_288 = "nishiwangge " + Symbol() + " - Buy " + ((gi_244 + 1));
g_lots_256 = NextLot("buy");
while (g_ticket_240 0 && NextOrder("sell")) {
g_comment_288 = "nishiwangge " + Symbol() + " - Sell " + ((gi_244 + 1));
g_lots_264 = NextLot("sell");
while (g_ticket_240 = 0; l_pos_24--) {
OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
if (as_0 == "buy") {
if (OrderType() == OP_BUY) {
l_price_8 = l_price_16 + Profit * Point;
if (OrderTakeProfit() != l_price_8) {
Print("填滂翳鲨痼屐 镱牦镪? " + DoubleToStr(l_price_16, 4) + ", 倚 = " + Profit + " 皖恹?箴钼屙?= " + DoubleToStr(l_price_8, 4));
OrderModify(OrderTicket(), l_price_16, OrderStopLoss(), l_price_8, 0, Yellow);
}
}
}
if (as_0 == "sell") {
if (OrderType() == OP_SELL) {
l_price_8 = l_price_16 - Profit * Point;
if (OrderTakeProfit() != l_price_8) {
Print("填滂翳鲨痼屐 镳钿噫? " + DoubleToStr(l_price_16, 4) + ", 倚 = " + Profit + " 皖恹?箴钼屙?= " + DoubleToStr(l_price_8, 4));
OrderModify(OrderTicket(), l_price_16, OrderStopLoss(), l_price_8, 0, Yellow);
}
}
}
}
}
}
double NewLot(string as_0) {
double ld_ret_8;
double l_minlot_16 = MarketInfo(Symbol(), MODE_MINLOT);
if (as_0 == "buy") {
if (gi_156) ld_ret_8 = LotSize;
else ld_ret_8 = NormalizeDouble(LotSize * NormalizeDouble(AccountBalance() / LotStep, 0), gi_236);
}
if (as_0 == "sell") {
if (gi_156) ld_ret_8 = LotSize;
else ld_ret_8 = NormalizeDouble(LotSize * NormalizeDouble(AccountBalance() / LotStep, 0), gi_236);
}
if (ld_ret_8 = li_8 * Point && CountTrades(as_0) = li_8 * Point && CountTrades(as_0) = l_iclose_16) li_ret_12 = TRUE;
else li_ret_12 = FALSE;
} else li_ret_12 = TRUE;
}
}
return (li_ret_12);
}
double FindLastOrder(string as_0, string as_8) {
double l_ord_open_price_16;
double l_ord_lots_24;
int l_ticket_32 = 0;
for (int l_pos_36 = OrdersTotal() - 1; l_pos_36 >= 0; l_pos_36--) {
OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
if (as_0 == "buy") {
if (OrderType() == OP_BUY) {
if (OrderTicket() > l_ticket_32) {
l_ord_open_price_16 = OrderOpenPrice();
l_ord_lots_24 = OrderLots();
l_ticket_32 = OrderTicket();
}
}
}
if (as_0 == "sell") {
if (OrderType() == OP_SELL) {
if (OrderTicket() > l_ticket_32) {
l_ord_open_price_16 = OrderOpenPrice();
l_ord_lots_24 = OrderLots();
l_ticket_32 = OrderTicket();
}
}
}
}
}
if (as_8 == "Price") return (l_ord_open_price_16);
if (as_8 == "Lots") return (l_ord_lots_24);
return (0.0);
}
int CountTrades(string as_0) {
int l_count_8 = 0;
for (int l_pos_12 = OrdersTotal() - 1; l_pos_12 >= 0; l_pos_12--) {
OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
if (as_0 == "buy")
if (OrderType() == OP_BUY) l_count_8++;
if (as_0 == "sell")
if (OrderType() == OP_SELL) l_count_8++;
}
}
return (l_count_8);
}
double AveragePrice(string as_0) {
double ld_8 = 0;
double ld_16 = 0;
for (int l_pos_24 = OrdersTotal() - 1; l_pos_24 >= 0; l_pos_24--) {
OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
if (as_0 == "buy") {
if (OrderType() == OP_BUY) {
ld_8 += OrderOpenPrice() * OrderLots();
ld_16 += OrderLots();
}
}
if (as_0 == "sell") {
if (OrderType() == OP_SELL) {
ld_8 += OrderOpenPrice() * OrderLots();
ld_16 += OrderLots();
}
}
}
}
ld_8 = NormalizeDouble(ld_8 / ld_16, Digits);
return (ld_8);
}
void Information() {
if (InformationOnChart) {
Comment("" + " www.aitrader.org " + Symbol() + " 信迫? " + gs_296
+ "\n"
+ " ------------------------------------------------"
+ "\n"
+ " 公司: " + AccountCompany() + ".杠杆 1:" + DoubleToStr(AccountLeverage(), 0)
+ "\n"
+ " ------------------------------------------------"
+ "\n"
+ " 多单订单数" + CountTrades("buy")
+ "\n"
+ " 多单获利 " + DoubleToStr(Balance("buy", "Balance"), 2)
+ "\n"
+ " 多单手数 " + DoubleToStr(Balance("buy", "Lot"), 2)
+ "\n"
+ " ------------------------------------------------"
+ "\n"
+ " 空单订单数" + CountTrades("sell")
+ "\n"
+ " 空单获利 " + DoubleToStr(Balance("sell", "Balance"), 2)
+ "\n"
+ " 空单手数 " + DoubleToStr(Balance("sell", "Lot"), 2)
+ "\n"
+ " ------------------------------------------------"
+ "\n"
+ " 总获利 " + DoubleToStr(Balance("buy", "Balance") + Balance("sell", "Balance"), 2)
+ "\n"
+ " ------------------------------------------------"
+ "\n"
+ " 交易信息"
+ "\n"
+ " ");
}
}
double Balance(string as_0, string as_8) {
double ld_ret_16 = 0;
for (int l_pos_24 = OrdersTotal() - 1; l_pos_24 >= 0; l_pos_24--) {
OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumber) continue;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
if (as_0 == "buy") {
if (OrderType() == OP_BUY) {
if (as_8 == "Balance") ld_ret_16 = ld_ret_16 + OrderProfit() - OrderSwap() - OrderCommission();
if (as_8 == "Lot") ld_ret_16 += OrderLots();
}
}
if (as_0 == "sell") {
if (OrderType() == OP_SELL) {
if (as_8 == "Balance") ld_ret_16 = ld_ret_16 + OrderProfit() - OrderSwap() - OrderCommission();
if (as_8 == "Lot") ld_ret_16 += OrderLots();
}
}
}
}
return (ld_ret_16);
}
double LotDecimal() {
double l_lotstep_0 = MarketInfo(Symbol(), MODE_LOTSTEP);
int li_ret_8 = MathCeil(MathAbs(MathLog(l_lotstep_0) / MathLog(10)));
return (li_ret_8);
} |