extern double TakeProfit1 = 300.0; extern double TakeProfit2 = 500.0; extern double Lots = 0.1; extern double TrailingStop = 0.0; extern double StopLoss = 0.0; int start() { int l_ticket_76; int l_count_80 = 0; if (Bars < 100) { Print("bars less than 100"); return (0); } if (TakeProfit1 < 10.0) { Print("TakeProfit less than 10"); return (0); } if (AccountBalance() < 5000.0) { Alert("We have no money. Should be more than 5000. Balance = ", AccountBalance()); return (0); } if (AccountFreeMargin() < AccountBalance() / 2.0) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } double l_ima_0 = iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_8 = iMA(NULL, 0, 300, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_16 = iMA(NULL, 0, 60, 0, MODE_EMA, PRICE_CLOSE, 0); double l_ima_24 = iMA(NULL, 0, 600, 0, MODE_EMA, PRICE_CLOSE, 0); double l_iatr_32 = iATR(NULL, 0, 20, 0); double l_irsi_40 = iRSI(NULL, 0, 14, PRICE_CLOSE, 0); double l_icci_48 = iCCI(NULL, 0, 14, PRICE_CLOSE, 0); double l_istochastic_56 = iStochastic(NULL, 0, 15, 3, 3, MODE_EMA, 0, MODE_MAIN, 0); double l_istochastic_64 = iStochastic(NULL, 0, 15, 3, 3, MODE_EMA, 0, MODE_SIGNAL, 0); l_count_80 = 0; int l_ord_total_84 = OrdersTotal(); for (int l_pos_72 = 0; l_pos_72 < l_ord_total_84; l_pos_72++) { OrderSelect(l_pos_72, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol()) l_count_80++; } if (l_count_80 == 0) { if (l_istochastic_56 > l_istochastic_64 && l_istochastic_56 < 14.0) { Alert("Buy Now - " + Symbol()); Print(l_ima_0); Print(l_ima_8); Print(l_istochastic_64); Print(l_istochastic_64); l_ticket_76 = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, StopLoss * Point, Ask + TakeProfit1 * Point, "Bet-1H-[01-30pp]-[14-86]", 505, 0, Green); if (l_ticket_76 > 0) { if (OrderSelect(l_ticket_76, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (l_istochastic_56 < 5.0 && l_istochastic_64 < 10.0) { Alert("Buy Now - " + Symbol()); Print(l_ima_0); Print(l_ima_8); Print(l_istochastic_64); Print(l_istochastic_64); l_ticket_76 = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, StopLoss * Point, Ask + TakeProfit2 * Point, "Bet-1H-[01-50pp]-[low 5-10]", 505, 0, Green); if (l_ticket_76 > 0) { if (OrderSelect(l_ticket_76, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (l_istochastic_56 < l_istochastic_64 && l_istochastic_56 > 86.0) { Alert("Sell Now - " + Symbol()); l_ticket_76 = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, StopLoss * Point, Bid - TakeProfit1 * Point, "Bet-1H-[01-30pp]-[14-86]", 505, 0, Red); if (l_ticket_76 > 0) { if (OrderSelect(l_ticket_76, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } if (l_istochastic_64 > 90.0 && l_istochastic_56 > 95.0) { Alert("Sell Now - " + Symbol()); l_ticket_76 = OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, StopLoss * Point, Bid - TakeProfit2 * Point, "Bet-1H-[01-50pp]-[High 90-95]", 505, 0, Red); if (l_ticket_76 > 0) { if (OrderSelect(l_ticket_76, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_72 = 0; l_pos_72 < l_ord_total_84; l_pos_72++) { OrderSelect(l_pos_72, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() != OP_BUY) continue; if (l_istochastic_56 > 50.0 && l_istochastic_56 < l_istochastic_64) return (0); if (TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (l_istochastic_56 < 50.0 && l_istochastic_56 > l_istochastic_64) return (0); if (TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * TrailingStop) { if (OrderStopLoss() > Ask + Point * TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } return (0); }