#include bool gi_76 = FALSE; bool gi_80 = FALSE; string gs_unused_84 = "第3条禁止止事項"; string gs_unused_92 = "1.お客様が本製品を譲渡、販売、転貸すること。"; string gs_unused_100 = "2.お客様がバックアップを目的とする以外に本製品を複製すること。"; string gs_unused_108 = "3.お客様が本製品をリバースエンジニアリング、逆コンパイル、または逆アセンブルすること。"; string gs_unused_116 = "4.お客様が本ソ\フトウェアの技術的な制限を回避して使用すること。"; string gs_unused_124 = "5.お客様が本条1項から4項までの禁止行為を行った場合、お客様はfx-on.comに対しfx-on.comが受けた損害を補填するものとする。"; extern int MAGIC = 3; extern int Slippage = 3; extern bool Compound = TRUE; extern int Manuallots = 1; extern int Broker_121 = 0; extern int Losscut = 500; extern double RTp = 0.15; extern double NTp1 = 0.13; extern double NTp2 = 0.2; extern double NTp3 = 0.2; extern int BalanceStep = 5000; extern int MovingAverages_60 = 14; extern bool Email = TRUE; int init() { gi_76 = AccountCertification(); gi_80 = DateCertification(); if (gi_76) Print("Account setting was approved."); if (gi_80) Print("Date setting was approved."); return (0); } int deinit() { return (0); } int start() { bool li_180; double l_ord_open_price_184; bool li_192; double l_ord_open_price_196; if (!gi_76) { Comment("\nTrading is not allowed. Wrong account : " + AccountNumber()); return (0); } if (!gi_80) { Comment("\nDate is invalid."); return (0); } if (Bars < 100 || IsTradeAllowed() == FALSE) return; double l_lots_0 = Manuallots / 100.0; double l_lots_8 = 0.04 * Manuallots; double l_lots_16 = 0.22 * Manuallots; double l_lots_24 = 1.2 * Manuallots; int li_32 = 1; if (Compound == TRUE) { li_32 = MathCeil((AccountBalance() - BalanceStep) / BalanceStep); if (li_32 > 39) li_32 = 40; if (Broker_121 == 1) { l_lots_0 = 10.0 * l_lots_0; l_lots_8 = 10.0 * l_lots_8; l_lots_16 = 10.0 * l_lots_16; l_lots_24 = 10.0 * l_lots_24; li_32 = 1; } if (Broker_121 == 2) { l_lots_0 = 10.0 * l_lots_0; l_lots_8 = 10.0 * l_lots_8; l_lots_16 = 10.0 * l_lots_16; l_lots_24 = 10.0 * l_lots_24; li_32 = 2; } if (li_32 > 1) { l_lots_0 = NormalizeDouble(l_lots_0 * li_32, 2); l_lots_8 = NormalizeDouble(l_lots_8 * li_32, 2); l_lots_16 = NormalizeDouble(l_lots_16 * li_32, 2); l_lots_24 = NormalizeDouble(l_lots_24 * li_32, 2); } } double l_ima_36 = iMA(NULL, PERIOD_M30, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_44 = iMA(NULL, PERIOD_M30, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 1); double l_ima_52 = iMA(NULL, PERIOD_M30, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 2); double l_ima_60 = iMA(NULL, PERIOD_H4, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_68 = iMA(NULL, PERIOD_H4, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 1); double l_ima_76 = iMA(NULL, PERIOD_H4, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 2); double l_ima_84 = iMA(NULL, PERIOD_M5, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 0); double l_ima_92 = iMA(NULL, PERIOD_M5, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 1); double l_ima_100 = iMA(NULL, PERIOD_M5, MovingAverages_60, 0, MODE_SMA, PRICE_CLOSE, 2); int li_unused_108 = 0; if (l_ima_36 - l_ima_52 > 0.01) li_unused_108 = 1; if (l_ima_36 - l_ima_52 < -0.01) li_unused_108 = 2; int li_112 = 0; if (l_ima_60 - l_ima_68 > 0.05) li_112 = 1; if (l_ima_60 - l_ima_68 < -0.05) li_112 = 2; int li_116 = 0; if (l_ima_92 - l_ima_100 > 0.0) li_116 = 1; if (l_ima_92 - l_ima_100 < 0.0) li_116 = 2; double l_icustom_120 = iCustom(NULL, PERIOD_M5, "ROC", 10, 0, 0, 0); double l_icustom_128 = iCustom(NULL, PERIOD_M5, "ROC", 10, 0, 0, 2); double ld_136 = l_icustom_128 - l_icustom_120; int li_unused_144 = 1; if (ld_136 < 0.0) li_unused_144 = 2; int li_unused_148 = 0; int li_152 = 0; int li_156 = 0; bool li_160 = FALSE; bool li_164 = FALSE; bool li_168 = FALSE; bool li_172 = FALSE; for (int l_pos_176 = OrdersTotal() - 1; l_pos_176 >= 0; l_pos_176--) { if (OrderSelect(l_pos_176, SELECT_BY_POS, MODE_TRADES) == FALSE) break; if (OrderMagicNumber() == MAGIC) { if (OrderType() == OP_BUY && OrderLots() == l_lots_24) { li_172 = TRUE; if (Bid - OrderOpenPrice() > NTp3) li_152 = 4; } if (OrderType() == OP_BUY && OrderLots() == l_lots_16) { li_168 = TRUE; if (Bid - OrderOpenPrice() > NTp2) li_152 = 3; } if (OrderType() == OP_BUY && OrderLots() == l_lots_8) { li_164 = TRUE; if (Bid - OrderOpenPrice() > NTp1) li_152 = 2; } if (OrderType() == OP_BUY && OrderLots() == l_lots_0) { li_180 = TRUE; li_160 = TRUE; l_ord_open_price_184 = OrderOpenPrice(); if (Bid - OrderOpenPrice() > RTp) li_152 = 1; } if (OrderType() == OP_SELL && OrderLots() == l_lots_24) { li_172 = TRUE; if (OrderOpenPrice() - Ask > NTp3) li_156 = 4; } if (OrderType() == OP_SELL && OrderLots() == l_lots_16) { li_168 = TRUE; if (OrderOpenPrice() - Ask > NTp2) li_156 = 3; } if (OrderType() == OP_SELL && OrderLots() == l_lots_8) { li_164 = TRUE; if (OrderOpenPrice() - Ask > NTp1) li_156 = 2; } if (OrderType() == OP_SELL && OrderLots() == l_lots_0) { li_192 = TRUE; li_160 = TRUE; l_ord_open_price_196 = OrderOpenPrice(); if (OrderOpenPrice() - Ask > RTp) li_156 = 1; } } } if (li_152 != 0 || li_160 == FALSE) { for (int li_204 = OrdersTotal(); li_204 >= 0; li_204--) { if (OrderSelect(0, SELECT_BY_POS, MODE_TRADES) == FALSE) break; if (OrderSymbol() != Symbol() || OrderMagicNumber() != MAGIC) continue; OrderClose(OrderTicket(), OrderLots(), Bid, 3, Green); } } if (li_156 != 0 || li_160 == FALSE) { for (int li_208 = OrdersTotal(); li_208 >= 0; li_208--) { if (OrderSelect(0, SELECT_BY_POS, MODE_TRADES) == FALSE) break; if (OrderSymbol() != Symbol() || OrderMagicNumber() != MAGIC) continue; OrderClose(OrderTicket(), OrderLots(), Ask, 3, Green); } } if (li_116 == 1 && li_112 == 1 && li_160 != TRUE && l_icustom_120 < 0.0) { OrderSend(Symbol(), OP_BUY, l_lots_0, Ask, Slippage, Ask - Point * Losscut, 0, "TTLP20_B1", MAGIC, 0, Blue); if (Email) SendMail("Ask Entry", "TTLP20 is Ask1 entry now! \nPrice:" + Ask); return (0); } if (li_180 == TRUE && li_160 == TRUE && li_164 != TRUE && Ask < l_ord_open_price_184 - 50.0 * Point) { OrderSend(Symbol(), OP_BUY, l_lots_8, Ask, Slippage, Ask - Point * Losscut, 0, "TTLP20_B2", MAGIC, 0, Blue); if (Email) SendMail("Ask Entry", "TTLP20 is Ask2 entry now! \nPrice:" + Ask); return (0); } if (li_180 == TRUE && li_160 == TRUE && li_164 == TRUE && li_168 != TRUE && Ask < l_ord_open_price_184 - 100.0 * Point) { OrderSend(Symbol(), OP_BUY, l_lots_16, Ask, Slippage, Ask - Point * Losscut, 0, "TTLP20_B3", MAGIC, 0, Blue); if (Email) SendMail("Ask Entry", "TTLP20 is Ask3 entry now! \nPrice:" + Ask); return (0); } if (li_180 == TRUE && li_160 == TRUE && li_164 == TRUE && li_168 == TRUE && li_172 != TRUE && Ask < l_ord_open_price_184 - 150.0 * Point && l_icustom_120 < -0.3) { OrderSend(Symbol(), OP_BUY, l_lots_24, Ask, Slippage, Ask - Point * Losscut, 0, "TTLP20_B4", MAGIC, 0, Blue); if (Email) SendMail("Ask Entry", "TTLP20 is Ask4 entry now! \nPrice:" + Ask); return (0); } if (li_116 == 2 && li_112 == 2 && li_160 != TRUE && l_icustom_120 > 0.0) { OrderSend(Symbol(), OP_SELL, l_lots_0, Bid, Slippage, Bid + Point * Losscut, 0, "TTLP20_S1", MAGIC, 0, Red); if (Email) SendMail("Bid Entry", "TTLP20 is Bid1 entry now! \nPrice:" + Bid); return (0); } if (li_192 == TRUE && li_160 == TRUE && li_164 != TRUE && Bid > l_ord_open_price_196 + 50.0 * Point) { OrderSend(Symbol(), OP_SELL, l_lots_8, Bid, Slippage, Bid + Point * Losscut, 0, "TTLP20_S2", MAGIC, 0, Red); if (Email) SendMail("Bid Entry", "TTLP20 is Bid2 entry now! \nPrice:" + Bid); return (0); } if (li_192 == TRUE && li_160 == TRUE && li_164 == TRUE && li_168 != TRUE && Bid > l_ord_open_price_196 + 100.0 * Point) { OrderSend(Symbol(), OP_SELL, l_lots_16, Bid, Slippage, Bid + Point * Losscut, 0, "TTLP20_S3", MAGIC, 0, Red); if (Email) SendMail("Bid Entry", "TTLP20 is Bid3 entry now! \nPrice:" + Bid); return (0); } if (li_192 == TRUE && li_160 == TRUE && li_164 == TRUE && li_168 == TRUE && li_172 != TRUE && Bid > l_ord_open_price_196 + 150.0 * Point && l_icustom_120 > 0.3) { OrderSend(Symbol(), OP_SELL, l_lots_24, Bid, Slippage, Bid + Point * Losscut, 0, "TTLP20_S4", MAGIC, 0, Red); if (Email) SendMail("Bid Entry", "TTLP20 is Bid4 entry now! \nPrice:" + Bid); return (0); } return (0); }