#property copyright “外汇联盟 www.FXunion.com QQ群144033”
#property link “”extern double lots = 1.0;
extern double trailingStop = 0.0;
extern double takeProfit = 110.0;
extern double stopLoss = 0.0;
extern double slippage = 3.0;
extern double dds_delay = 64800.0;
extern bool PowerTrend = TRUE;
extern double PM_Adjust = 1.6982;
extern bool Max_Deviation = TRUE;
extern bool Ivy_Trend = TRUE;
extern string ClickbankCode = “000”;
extern double Pin_under = 7.0;
extern double Long_cut = 8.0;
extern double crmRPM = 14.0;
extern double Pound_level = 26.0;
extern int CBCINTVALUE = 8;
extern double Dscan = 0.003;
extern double Hscan = 0.001;
extern string nameEA = “IVYBOT_EUR_USD”;
double g_ima_308;
double g_ima_316;
double g_iadx_452;
double g_iadx_460;
double g_iatr_468;
double g_iadx_476;
double g_iadx_484;
double g_iadx_492;
double g_iadx_500;
double g_price_508;
double g_price_516;
double gd_524;
double gd_532;
double g_ima_540;
bool g_bool_548 = FALSE;
bool g_bool_552 = FALSE;
bool gi_unused_556 = FALSE;
int g_pos_560;
int g_ticket_564;
int g_str_len_568;int init() {
return (0);
}int deinit() {
return (0);
}int start() {
/*g_str_len_568 = StringLen(ClickbankCode);
if (g_str_len_568 > CBCINTVALUE || g_str_len_568 < CBCINTVALUE) {
Comment(“Trade on Account: ” + AccountNumber() + “NOT AUTHORIZED BY IVYBOT!”);
return (0);
}*/
Comment(“”);
if (Period() != PERIOD_H1) {
Comment(“Must be 1H Chart!”);
return (0);
}
Comment(“”);
Display_Info();
if (Bars < 200) {
Print(“Not enough bars for this strategy – “, nameEA);
return (-1);
}
calculateIndicators();
int l_ord_total_0 = OrdersTotal();
int l_count_4 = 0;
for (g_pos_560 = 0; g_pos_560 < l_ord_total_0; g_pos_560++) {
OrderSelect(g_pos_560, SELECT_BY_POS);
if (OrderSymbol() == Symbol() && OrderType() <= OP_SELL && OrderComment() == nameEA) {
l_count_4++;
if (OrderType() == OP_BUY) {
if (TimeCurrent() – OrderOpenTime() > dds_delay) {
OrderClose(OrderTicket(), OrderLots(), Bid, slippage, Violet);
prtAlert(“IVYBOT_EUR_USD: Closing BUY order”);
}
if (trailingStop > 0.0) {
if (Bid – OrderOpenPrice() > trailingStop * Point)
if (OrderStopLoss() < Bid – trailingStop * Point) OrderModify(OrderTicket(), OrderOpenPrice(), Bid – trailingStop * Point, OrderTakeProfit(), 0, Blue);
}
} else {
if (TimeCurrent() – OrderOpenTime() > dds_delay) {
OrderClose(OrderTicket(), OrderLots(), Ask, slippage, Violet);
prtAlert(“IVYBOT_EUR_USD: Closing SELL order”);
}
if (trailingStop > 0.0) {
if (OrderOpenPrice() – Ask > trailingStop * Point)
if (OrderStopLoss() == 0.0 || OrderStopLoss() > Ask + trailingStop * Point) OrderModify(OrderTicket(), OrderOpenPrice(), Ask + trailingStop * Point, OrderTakeProfit(), 0, Red);
}
}
}
}
if (l_count_4 < 1) {
if (AccountFreeMargin() < 1000.0 * lots) {
Print(“Not enough money to trade “, lots, ” lots. Strategy:”, nameEA);
return (0);
}
if (g_bool_548 && !g_bool_552) {
if (stopLoss > 0.0) g_price_516 = Ask – stopLoss * Point;
if (takeProfit > 0.0) g_price_508 = Ask + takeProfit * Point;
g_ticket_564 = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, g_price_516, g_price_508, nameEA, 16384, 0, Red);
if (g_ticket_564 < 0) Print(“OrderSend (“, nameEA, “) failed with error #”, GetLastError());
prtAlert(“IVYBOT_EUR_USD: Buying”);
}
if (g_bool_552 && !g_bool_548) {
if (stopLoss > 0.0) g_price_516 = Bid + stopLoss * Point;
if (takeProfit > 0.0) g_price_508 = Bid – takeProfit * Point;
g_ticket_564 = OrderSend(Symbol(), OP_SELL, lots, Bid, slippage, g_price_516, g_price_508, nameEA, 16384, 0, Red);
if (g_ticket_564 < 0) Print(“OrderSend (“, nameEA, “) failed with error #”, GetLastError());
prtAlert(“IVYBOT_EUR_USD: Selling”);
}
}
return (0);
}void calculateIndicators() {
g_ima_308 = iMA(NULL, 0, 13, 0, MODE_EMA, PRICE_CLOSE, 8);
g_ima_316 = iMA(NULL, 0, 13, 0, MODE_EMA, PRICE_CLOSE, 0);
g_iadx_452 = iADX(NULL, 0, crmRPM, PRICE_CLOSE, MODE_MAIN, 1);
g_iadx_460 = iADX(NULL, 0, crmRPM, PRICE_CLOSE, MODE_MAIN, 2);
g_iadx_476 = iADX(NULL, 0, crmRPM, PRICE_CLOSE, MODE_PLUSDI, 1);
g_iadx_484 = iADX(NULL, 0, crmRPM, PRICE_CLOSE, MODE_PLUSDI, 2);
g_iadx_500 = iADX(NULL, 0, crmRPM, PRICE_CLOSE, MODE_MINUSDI, 1);
g_iadx_492 = iADX(NULL, 0, crmRPM, PRICE_CLOSE, MODE_MINUSDI, 2);
g_iatr_468 = iATR(NULL, 0, 50, 0);
gd_524 = iMA(NULL, PERIOD_D1, Pin_under, 0, MODE_EMA, PRICE_MEDIAN, 0) – iMA(NULL, PERIOD_D1, Pin_under, 0, MODE_EMA, PRICE_MEDIAN, Long_cut);
gd_532 = iMA(NULL, PERIOD_H4, Pin_under, 0, MODE_EMA, PRICE_MEDIAN, 0) – iMA(NULL, PERIOD_H4, Pin_under, 0, MODE_EMA, PRICE_MEDIAN, Long_cut);
g_ima_540 = iMA(NULL, PERIOD_H1, Pound_level, 0, MODE_EMA, PRICE_MEDIAN, 0);
g_bool_548 = gd_524 > Dscan && gd_532 > Hscan && g_ima_540 > Ask && g_iadx_452 > 35.0 && g_iadx_452 < 55.0 && g_iadx_460 < 55.0 && g_iatr_468 < 0.007 && (Hour() > 9 &&
Hour() < 24);
g_bool_552 = gd_524 < (-1.0 * Dscan) && gd_532 < (-1.0 * Hscan) && g_ima_540 < Bid && g_iadx_452 > 35.0 && g_iadx_452 < 55.0 && g_iadx_460 < 55.0 && g_iatr_468 < 0.007 && (Hour() > 9 && Hour() < 24);
gi_unused_556 = FALSE;
}void prtAlert(string as_0 = “”) {
Print(as_0);
Alert(as_0);
}void Display_Info() {
Comment(“IVYBOT EXPERT ADVISOR\n”, “Desc: Currently Scanning All Trends,\n”, “Forex Account Server:”, AccountServer(),
“\n”, “Free Margin: $”, AccountFreeMargin(),
“\n”, “Lots: “, lots,
“\n”, “Symbol: “, Symbol(),
“\n”, “Price: “, NormalizeDouble(Bid, 4),
“\n”, “Optimal Spread: “, MarketInfo(“EURUSD”, MODE_SPREAD),
“\n”, “Date: “, Month(), “-“, Day(), “-“, Year(), ” Server Time: “, Hour(), “:”, Minute(), “:”, Seconds(),
“\n”);
}
相关资源
暂无评论...