#property copyright "Copyright © Forex Warlord" #property link "" bool gi_76 = FALSE; extern bool EachTickMode = TRUE; extern double Lots = 1.0; extern int StopLoss = 250; extern int TakeProfit = 500; extern int TrailingStop = 55; extern int TrendPower = 21; extern int TrendLevel = 200; bool gi_112 = TRUE; bool gi_116 = TRUE; bool gi_120 = TRUE; double g_point_124; extern int Slippage = 3; extern int MagicNumber = 7777799; int g_bars_140; int gi_144; bool gi_148 = FALSE; int init() { g_bars_140 = Bars; if (EachTickMode) gi_144 = 0; else gi_144 = 1; return (0); } int deinit() { return (0); } int start() { int l_ticket_8; double l_price_12; double l_price_20; if (TimeMonth(TimeCurrent() && TimeYear(TimeCurrent())) >= 12.2009) { Alert("Expired Version.. Contract us for an update"); return (0); } int li_0 = 0; if (Point == 0.00001) g_point_124 = 0.0001; else { if (Point == 0.001) g_point_124 = 0.01; else g_point_124 = Point; } if (EachTickMode && Bars != g_bars_140) gi_148 = FALSE; int l_ord_total_4 = OrdersTotal(); li_0 = 0; HideTestIndicators(TRUE); double l_ima_28 = iMA(NULL, 0, 6, 0, MODE_EMA, PRICE_CLOSE, gi_144 + 0); double l_ima_36 = iMA(NULL, 0, 100, 0, MODE_EMA, PRICE_CLOSE, gi_144 + 0); double l_ima_44 = iMA(NULL, 0, 6, 0, MODE_EMA, PRICE_CLOSE, gi_144 + 0); double l_ima_52 = iMA(NULL, 0, 100, 0, MODE_EMA, PRICE_CLOSE, gi_144 + 0); double l_imomentum_60 = iMomentum(NULL, 0, TrendLevel, PRICE_OPEN, 1); double l_imomentum_68 = iMomentum(NULL, 0, TrendLevel, PRICE_OPEN, 0); double l_imacd_76 = iMACD(NULL, 0, 90, 99, 88, PRICE_TYPICAL, MODE_MAIN, 0); double l_imacd_84 = iMACD(NULL, 0, 90, 99, 88, PRICE_TYPICAL, MODE_MAIN, 1); double l_imacd_92 = iMACD(NULL, 0, 90, 99, 88, PRICE_TYPICAL, MODE_SIGNAL, 0); double l_iadx_100 = iADX(NULL, 0, TrendPower, PRICE_CLOSE, MODE_MAIN, 0); HideTestIndicators(FALSE); bool li_108 = FALSE; for (int l_pos_112 = 0; l_pos_112 < l_ord_total_4; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { li_108 = TRUE; if (OrderType() == OP_BUY) { if (li_0 == 3 && (EachTickMode && !gi_148) || (!EachTickMode && Bars != g_bars_140)) { OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen); if (gi_76) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy"); if (!EachTickMode) g_bars_140 = Bars; li_108 = FALSE; } else { if (gi_112 && TrailingStop > 0) { if (Bid - OrderOpenPrice() > g_point_124 * TrailingStop) { if (OrderStopLoss() < Bid - g_point_124 * TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - g_point_124 * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen); if (!EachTickMode) g_bars_140 = Bars; } } } } } else { if (li_0 == 4 && (EachTickMode && !gi_148) || (!EachTickMode && Bars != g_bars_140)) { OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange); if (gi_76) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell"); if (!EachTickMode) g_bars_140 = Bars; li_108 = FALSE; } else { if (gi_112 && TrailingStop > 0) { if (OrderOpenPrice() - Ask > g_point_124 * TrailingStop) { if (OrderStopLoss() > Ask + g_point_124 * TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + g_point_124 * TrailingStop, OrderTakeProfit(), 0, DarkOrange); if (!EachTickMode) g_bars_140 = Bars; } } } } } } } if (l_ima_28 > l_ima_36 && l_imomentum_68 > 100.0 && l_iadx_100 > 21.0 && l_imacd_92 > 100.0) li_0 = 1; if (l_ima_44 > l_ima_52 && l_imomentum_68 < 100.0 && l_iadx_100 < 21.0 && l_imacd_92 < 100.0) li_0 = 2; if (li_0 == 1 && (EachTickMode && !gi_148) || (!EachTickMode && Bars != g_bars_140)) { if (!li_108) { if (AccountFreeMargin() < 1000.0 * Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (gi_120) l_price_12 = Ask - StopLoss * g_point_124; else l_price_12 = 0.0; if (gi_116) l_price_20 = Ask + TakeProfit * g_point_124; else l_price_20 = 0.0; l_ticket_8 = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, l_price_12, l_price_20, "Buy(#" + MagicNumber + ")", MagicNumber, 0, DodgerBlue); if (l_ticket_8 > 0) { if (OrderSelect(l_ticket_8, SELECT_BY_TICKET, MODE_TRADES)) { Print("BUY order opened : ", OrderOpenPrice()); if (gi_76) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Open Buy"); } else Print("Error opening BUY order : ", GetLastError()); } if (EachTickMode) gi_148 = TRUE; if (!EachTickMode) g_bars_140 = Bars; return (0); } } if (li_0 == 2 && (EachTickMode && !gi_148) || (!EachTickMode && Bars != g_bars_140)) { if (!li_108) { if (AccountFreeMargin() < 1000.0 * Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (gi_120) l_price_12 = Bid + StopLoss * g_point_124; else l_price_12 = 0.0; if (gi_116) l_price_20 = Bid - TakeProfit * g_point_124; else l_price_20 = 0.0; l_ticket_8 = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, l_price_12, l_price_20, "Sell(#" + MagicNumber + ")", MagicNumber, 0, DeepPink); if (l_ticket_8 > 0) { if (OrderSelect(l_ticket_8, SELECT_BY_TICKET, MODE_TRADES)) { Print("SELL order opened : ", OrderOpenPrice()); if (gi_76) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Open Sell"); } else Print("Error opening SELL order : ", GetLastError()); } if (EachTickMode) gi_148 = TRUE; if (!EachTickMode) g_bars_140 = Bars; return (0); } } if (!EachTickMode) g_bars_140 = Bars; return (0); }