找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 6|回复: 0

[MT4] 飞天神马

[复制链接]

274

主题

6

回帖

1020

积分

管理员

积分
1020
发表于 昨天 11:44 | 显示全部楼层 |阅读模式
#include <stderror.mqh>
#include <stdlib.mqh>
#property copyright "飞天神马 VX:Mirootsoft"

extern bool Buy = TRUE;//允许买
extern bool Sell = TRUE;//允许卖
extern bool FirstOrder = TRUE;//是不是第一单
extern bool OpenTrend = FALSE;//价格跟趋势一致后过一步后是否下单
extern int FirstStep = 10;//第一步点数
extern int MinDistance =1000;//最小间距点数(每步之间)
extern int Step =1000;//每步点数
extern int MinDistance1 =200;//最小间距点数(每步之间)
extern int Step1 = 200;//每步点数
extern int iCount=1;//几步之后启动方式1点数和最小间距
extern int StepTrallOrders = 5;//修改挂单跟踪点数
extern double MaxLoss = 1000000.0;//最大损失金额
extern double MaxLossCloseAll = 10000.0;//最大允许平仓的损失金额
extern double lot = 0.01;//手数
extern double PlusLot = 0.0;//手数增加倍数
extern double K_Lot = 1.12;//手数增加指数(初级手数的多少次方)
extern int DigitsLot = 2;//价格后小数点位数
extern double CloseAll =5.0;//获利金额多少平仓
extern double StopProfit =10.0;//仓位平仓获利金额
extern double StopLoss =600.0;//中间过程止损金额
extern int Magic = 888;//订单识别魔术号
extern int font_size = 18;//字体大小
extern color text_color = Lime;//字体颜色
extern string ___________________ = "";
extern string parameters_trailing = "0-off  1-Candle  2-Fractals  >2-pips";//设为0-关闭 1-焟烛 2-分形 〉2点数
extern int TrailingStop = 1;//设上栏值
extern int TrailingStep = 0;//跟踪止损步数
extern int MinProfit =50;//最小获利
extern int delta = 0;
extern int TF_Tralling = 1;//时间周期,指标用(0为默认图表周期,单位为分钟)
extern int Key = 0;//Key软件序列号,一定要是0
extern string a="时间";
extern bool sj=false;//启用时间
extern int star=8;//开始小时
extern int end=23;//结束小时
extern string orderNote = "QQ:100200230";
bool bReal;
int stopLevel;
int Gi_236 = 5;
int G_acc_number_240;
int slippage;
int buyMinDistance = 30;//最小间距点数(每步之间)
int buyStep = 30;//每步点数
int sellMinDistance = 30;//最小间距点数(每步之间)
int sellStep = 30;//每步点数

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   TF_Tralling = f0_0(TF_Tralling);
   if (Digits == 5 || Digits == 3) slippage = 30;
   Comment("");
   stopLevel = (int)MarketInfo(Symbol(), MODE_STOPLEVEL);
   if (Step < stopLevel) {
      Alert("Step < STOPLEVEL", stopLevel);
      Step = stopLevel;
   }
   if (FirstStep < stopLevel) {
      Alert("FirstStep < STOPLEVEL", stopLevel);
      FirstStep = stopLevel;
   }
   int y_0 = font_size + font_size / 2;
   ObjectCreate("Balance", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Balance", OBJPROP_CORNER, 1);
   ObjectSet("Balance", OBJPROP_XDISTANCE, 5);
   ObjectSet("Balance", OBJPROP_YDISTANCE, y_0);
   y_0 += font_size * 2;
   ObjectCreate("Equity", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Equity", OBJPROP_CORNER, 1);
   ObjectSet("Equity", OBJPROP_XDISTANCE, 5);
   ObjectSet("Equity", OBJPROP_YDISTANCE, y_0);
   y_0 += font_size * 2;
   ObjectCreate("FreeMargin", OBJ_LABEL, 0, 0, 0);
   ObjectSet("FreeMargin", OBJPROP_CORNER, 1);
   ObjectSet("FreeMargin", OBJPROP_XDISTANCE, 5);
   ObjectSet("FreeMargin", OBJPROP_YDISTANCE, y_0);
   y_0 += font_size * 2;
   G_acc_number_240 = 1;
   bReal = (!IsDemo()) && (!IsTesting());
   ObjectCreate("ProfitB", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ProfitB", OBJPROP_CORNER, 1);
   ObjectSet("ProfitB", OBJPROP_XDISTANCE, 5);
   ObjectSet("ProfitB", OBJPROP_YDISTANCE, y_0);
   y_0 += font_size * 2;
   ObjectCreate("ProfitS", OBJ_LABEL, 0, 0, 0);
   ObjectSet("ProfitS", OBJPROP_CORNER, 1);
   ObjectSet("ProfitS", OBJPROP_XDISTANCE, 5);
   ObjectSet("ProfitS", OBJPROP_YDISTANCE, y_0);
   y_0 += font_size * 2;
   ObjectCreate("Profit", OBJ_LABEL, 0, 0, 0);
   ObjectSet("Profit", OBJPROP_CORNER, 1);
   ObjectSet("Profit", OBJPROP_XDISTANCE, 5);
   ObjectSet("Profit", OBJPROP_YDISTANCE, y_0);
   y_0 += 3 * font_size;
   bool Li_4 = FALSE;
   string Ls_8 = "Param" + (string)Li_4;
   MaxLossCloseAll = -1.0 * MaxLossCloseAll;
   MaxLoss = -1.0 * MaxLoss;
   StopLoss = -1.0 * StopLoss;
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   ObjectsDeleteAll(0);
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
void start()
{
/* if(AccountNumber( )!=258042)
  {
    Alert("帐号"+AccountNumber( )+"不可交易");
    return;
  }*/
  datetime jieshu=StrToTime("2037.6.30 23:59:00");
  if(TimeCurrent()>jieshu)
  {
    Alert("EA使用到期!请联系QQ:100200230");
    Sleep(3600000);
    return;
  }

// if(TimeCurrent()>StringToTime("2111.09.12"))
//{Alert("到期了");return;}
   double price;
   double Ld_8=0;
   double Ld_16=0;
   double Ld_24=0;
   double Ld_32=0;
   double order_lots;
   int Li_48=0;
   int Li_52=0;
   int Li_56=0;
   int Li_60=0;
   int ordertype;
   int ticket_68;
   int ticket_72;
   double price_76=0;
   double price_84=0;
   double price_92=0;
   double price_100=0;
   double price_108;
   double price_116;
   double Ld_124=0;
   double Ld_132=0;
   double price_140=0;
   double price_148=0;
   double price_156;
   double price_164;
   double price_172;
   double price_180;
   double lots_188;
   /*
   if (bReal && Key != 5 * G_acc_number_240 - Gi_236) {
      Comment("\n-----------------  ",
         "\nTo work in the real world, enter the key (numeric code in the Key)",
         "\nTo get the key pay ¥ 50 and send your trading account, which will work on the adviser mail cendada@gmail.com",
         "\nThe comments indicate the payment details.",
         "\npayment: http://www.besteastore.com",
         "\nOnce payment send an account number and I ll do it on key.",
         "\nemail: cendada@gmail.com",
         "\n-----------------  ",
      "\nYour AccountNumber :", G_acc_number_240);
      return ;
   }
   */
   for (int pos = 0; pos < OrdersTotal(); pos++) {
      if (OrderSelect(pos, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == Symbol() && Magic == OrderMagicNumber()) {
            ordertype = OrderType();
            order_lots = OrderLots();
            price = NormalizeDouble(OrderOpenPrice(), Digits);
            if (ordertype == OP_BUYSTOP) {
               Li_56++;
               if (price_76 < price || price_76 == 0.0) price_76 = price;
               ticket_68 = OrderTicket();
               price_108 = price;
            }
            if (ordertype == OP_SELLSTOP) {
               Li_60++;
               if (price_100 > price || price_100 == 0.0) price_100 = price;
               ticket_72 = OrderTicket();
               price_116 = price;
            }
            if (ordertype == OP_BUY) {
               Li_48++;
               Ld_24 += order_lots;
               Ld_132 += price * order_lots;
               if (price_76 < price || price_76 == 0.0) price_76 = price;
               if (price_84 > price || price_84 == 0.0) price_84 = price;
               Ld_16 += OrderProfit() + OrderSwap() + OrderCommission();
            }
            if (ordertype == OP_SELL) {
               Li_52++;
               Ld_32 += order_lots;
               Ld_124 += price * order_lots;
               if (price_100 > price || price_100 == 0.0) price_100 = price;
               if (price_92 < price || price_92 == 0.0) price_92 = price;
               Ld_8 += OrderProfit() + OrderSwap() + OrderCommission();
            }
         }
      }
   }

   if(Li_48>iCount)//buy
   {
     buyMinDistance = MinDistance1;//最小间距点数(每步之间)
     buyStep = Step1;//每步点数
   }
   else
   {
     buyMinDistance = MinDistance;//最小间距点数(每步之间)
     buyStep = Step;//每步点数
   }

   if(Li_52>iCount)//sell
   {
     sellMinDistance = MinDistance1;//最小间距点数(每步之间)
     sellStep = Step1;//每步点数
   }
   else
   {
     sellMinDistance = MinDistance;//最小间距点数(每步之间)
     sellStep = Step;//每步点数
   }


   ObjectDelete("SLb");
   ObjectDelete("SLs");
   if (Li_48 > 0) {
      price_140 = NormalizeDouble(Ld_132 / Ld_24, Digits);
      ObjectCreate("SLb", OBJ_ARROW, 0, Time[0], price_140, 0, 0, 0, 0);
      ObjectSet("SLb", OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
      ObjectSet("SLb", OBJPROP_COLOR, Blue);
   }
   if (Li_52 > 0) {
      price_148 = NormalizeDouble(Ld_124 / Ld_32, Digits);
      ObjectCreate("SLs", OBJ_ARROW, 0, Time[0], price_148, 0, 0, 0, 0);
      ObjectSet("SLs", OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
      ObjectSet("SLs", OBJPROP_COLOR, Red);
   }
   if (TrailingStop != 0) {
      for (   pos = 0; pos < OrdersTotal(); pos++) {
         if (OrderSelect(pos, SELECT_BY_POS, MODE_TRADES)) {
            if (OrderSymbol() == Symbol() && Magic == OrderMagicNumber()) {
               ordertype = OrderType();
               price_156 = NormalizeDouble(OrderStopLoss(), Digits);
               price = NormalizeDouble(OrderOpenPrice(), Digits);
               price_164 = price_156;
               if (ordertype == OP_BUY) {
                  price_172 = f0_2(1, Bid, TrailingStop);
                  if (price_172 >= price_140 + MinProfit * Point && price_172 > price_156 + TrailingStep * Point && (Bid - price_172) / Point > stopLevel) price_164 = price_172;
                  if (price_164 > price_156)
                     if (!OrderModify(OrderTicket(), price, price_164, OrderTakeProfit(), 0, White)) Print("Error ", GetLastError(), "   TrailingStop Modify Buy  SL ", price_156, "->", price_164);
               }
               if (ordertype == OP_SELL) {
                  price_172 = f0_2(-1, Ask, TrailingStop);
                  if (price_172 <= price_148 - MinProfit * Point && (price_172 < price_156 - TrailingStep * Point || (price_156 == 0.0)) && (price_172 - Ask) / Point > stopLevel) price_164 = price_172;
                  if (price_164 < price_156 || (price_156 == 0.0 && price_164 != 0.0))
                     if (!OrderModify(OrderTicket(), price, price_164, OrderTakeProfit(), 0, White)) Print("Error ", GetLastError(), "   TrailingStop Modify Sell  SL ", price_156, "->", price_164, "  TP ");
               }
            }
         }
      }
   }
   if (Ld_16 > MaxLossCloseAll && Ld_8 > MaxLossCloseAll) {
      ObjectSetText("Char.op", CharToStr(251), font_size + 2, "Wingdings", Silver);
      if (Ld_16 >= StopProfit) {
         Print("Buy Profit ", Ld_16);
         f0_1(1);
         return;
      }
      if (Ld_8 >= StopProfit) {
         Print("Sell Profit ", Ld_8);
         f0_1(-1);
         return;
      }
   } else {
      ObjectSetText("Char.op", CharToStr(74), font_size + 2, "Wingdings", Red);
      if (Ld_16 + Ld_8 >= CloseAll) {
         Print("CloseAll ", Ld_16 + Ld_8);
         f0_1(0);
         return;
      }
   }
   if (Ld_16 <= StopLoss) {
      Print("Buy Loss ", Ld_16);
      f0_1(1);
      return;
   }
   if (Ld_8 <= StopLoss) {
      Print("Sell Loss ", Ld_8);
      f0_1(-1);
      return;
   }
   if (Ld_16 <= MaxLoss) {
      Comment("Buy");
      ObjectSetText("Char.b", CharToStr(225) + CharToStr(251), font_size, "Wingdings", Red);
   } else ObjectSetText("Char.b", CharToStr(233), font_size, "Wingdings", Lime);
   if (Ld_8 <= MaxLoss) {
      Comment("Sell");
      ObjectSetText("Char.s", CharToStr(226) + CharToStr(251), font_size, "Wingdings", Red);
   } else ObjectSetText("Char.s", CharToStr(234), font_size, "Wingdings", Lime);
   Print("Ld_16",Ld_16);
   if (Li_56 == 0 && Ld_16 > MaxLoss && Buy) {
      if (Li_48 == 0) price_180 = NormalizeDouble(Ask + FirstStep * Point, Digits);
      else {
         price_180 = NormalizeDouble(Ask + buyMinDistance * Point, Digits);
         if (price_180 < NormalizeDouble(price_84 - buyStep * Point, Digits)) price_180 = NormalizeDouble(Ask + buyStep * Point, Digits);
      }
      if (Li_48 == 0 || (price_76 != 0.0 && price_180 >= NormalizeDouble(price_76 + buyStep * Point, Digits) && OpenTrend) || (price_84 != 0.0 && price_180 <= NormalizeDouble(price_84 - buyStep * Point,
         Digits))) {
         if (Li_48 == 0) lots_188 = lot;
         else lots_188 = NormalizeDouble(lot * MathPow(K_Lot, Li_48) + Li_48 * PlusLot, DigitsLot);
         if ((lots_188 < AccountFreeMargin() / MarketInfo(Symbol(), MODE_MARGINREQUIRED) && Li_48 > 0) || FirstOrder)
         {
         if(sj==false||(sj==true&&Hour()>star&&Hour()<end))
         {
         int res = OrderSend(Symbol(), OP_BUYSTOP, lots_188, price_180, slippage, 0, 0, orderNote, Magic, 0, Blue);}
         else Comment("Lot ", DoubleToStr(lots_188, 2));
      }
      }
   }
   if (Li_60 == 0 && Ld_8 > MaxLoss && Sell) {
      if (Li_52 == 0) price_180 = NormalizeDouble(Bid - FirstStep * Point, Digits);
      else {
         price_180 = NormalizeDouble(Bid - sellMinDistance * Point, Digits);
         if (price_180 < NormalizeDouble(price_92 + sellStep * Point, Digits)) price_180 = NormalizeDouble(Bid - sellStep * Point, Digits);
      }
      if (Li_52 == 0 || (price_100 != 0.0 && price_180 <= NormalizeDouble(price_100 - sellStep * Point, Digits) && OpenTrend) || (price_92 != 0.0 && price_180 >= NormalizeDouble(price_92 +
         sellStep * Point, Digits))) {
         if (Li_52 == 0) lots_188 = lot;
         else lots_188 = NormalizeDouble(lot * MathPow(K_Lot, Li_52) + Li_52 * PlusLot, DigitsLot);
         if ((lots_188 < AccountFreeMargin() / MarketInfo(Symbol(), MODE_MARGINREQUIRED) && Li_52 > 0 )|| FirstOrder)
        {
         if(sj==false||(sj==true&&Hour()>star&&Hour()<end))

          res = OrderSend(Symbol(), OP_SELLSTOP, lots_188, price_180, slippage, 0, 0, orderNote, Magic, 0, Red);
         else Comment("Lot ", DoubleToStr(lots_188, 2));
      }
   }}
   ObjectSetText("Balance", StringConcatenate("Balance ", DoubleToStr(AccountBalance(), 2)), font_size, "Arial", text_color);
   ObjectSetText("Equity", StringConcatenate("Equity ", DoubleToStr(AccountEquity(), 2)), font_size, "Arial", text_color);
   ObjectSetText("FreeMargin", StringConcatenate("Free Margin ", DoubleToStr(AccountFreeMargin(), 2)), font_size, "Arial", text_color);
   double Ld_200 = Ld_16 + Ld_8;
   if (Ld_24 > 0.0) {
      ObjectSetText("ProfitB", StringConcatenate("Buy ", Li_48, "   Profit ", DoubleToStr(Ld_16, 2), "  Lot = ", DoubleToStr(Ld_24, 2)), font_size, "Arial", f0_3(Ld_16 > 0.0,
         65280, 255));
   } else ObjectSetText("ProfitB", "", font_size, "Arial", Gray);
   if (Ld_32 > 0.0) {
      ObjectSetText("ProfitS", StringConcatenate("Sell ", Li_52, "   Profit ", DoubleToStr(Ld_8, 2), "  Lot = ", DoubleToStr(Ld_32, 2)), font_size, "Arial", f0_3(Ld_8 > 0.0,
         65280, 255));
   } else ObjectSetText("ProfitS", "", font_size, "Arial", Gray);
   if (Ld_32 + Ld_24 > 0.0) ObjectSetText("Profit", StringConcatenate("Profit All ", DoubleToStr(Ld_200, 2)), font_size, "Arial", f0_3(Ld_200 >= 0.0, 32768, 255));
   else ObjectSetText("Profit", "", font_size, "Arial", Gray);
   if (price_108 != 0.0 && Buy) {
      if (Li_48 == 0) price_180 = NormalizeDouble(Ask + FirstStep * Point, Digits);
      else price_180 = NormalizeDouble(Ask + buyMinDistance * Point, Digits);
      if (NormalizeDouble(price_108 - StepTrallOrders * Point, Digits) > price_180 && (price_180 <= NormalizeDouble(price_84 - buyStep * Point, Digits) || price_84 == 0.0 ||
         OpenTrend) && (Li_48 == 0 || price_180 >= NormalizeDouble(price_76 + buyStep * Point, Digits) || price_180 <= NormalizeDouble(price_84 - buyStep * Point, Digits))) {
         if (!OrderModify(ticket_68, price_180, 0, 0, 0, White)) Print("Error ", GetLastError(), "   Order Modify Buy   OOP ", price_108, "->", price_180);
         else Print("Order Buy Modify   OOP ", price, "->", price_180);
      }
   }
   if (price_116 != 0.0 && Sell) {
      if (Li_52 == 0) price_180 = NormalizeDouble(Bid - FirstStep * Point, Digits);
      else price_180 = NormalizeDouble(Bid - sellMinDistance * Point, Digits);
      if (NormalizeDouble(price_116 + StepTrallOrders * Point, Digits) < price_180 && (price_180 >= NormalizeDouble(price_92 + sellStep * Point, Digits) || price_92 == 0.0 ||
         OpenTrend) && (Li_52 == 0 || price_180 <= NormalizeDouble(price_100 - sellStep * Point, Digits) || price_180 >= NormalizeDouble(price_92 + sellStep * Point, Digits))) {
         if (!OrderModify(ticket_72, price_180, 0, 0, 0, White)) Print("Error ", GetLastError(), "   Order Modify Sell   OOP ", price_116, "->", price_180);
         else Print("Order Sell Modify   OOP ", price, "->", price_180);
      }
   }
   return;
}

// 441F2875E7D7BD4233BE798272C8614E
int f0_1(int Ai_0) {
   int error_4;
   int Li_8;
   int cmd_12;
   int count_16;
   bool Li_20 = TRUE;
   if ((!bReal) || Key == 5 * G_acc_number_240 - Gi_236) {
      while (true) {
         for (int pos_24 = OrdersTotal() - 1; pos_24 >= 0; pos_24--) {
            if (OrderSelect(pos_24, SELECT_BY_POS)) {
               if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) {
                  cmd_12 = OrderType();
                  if (cmd_12 == OP_BUY && (Ai_0 == 1 || Ai_0 == 0)) {
                     Li_20 = OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), slippage, Blue);
                     if (Li_20) Comment("", OrderTicket(), "", OrderProfit(), "     ", TimeToStr(TimeCurrent(), TIME_SECONDS));
                  }
                  if (cmd_12 == OP_SELL && (Ai_0 == -1 || Ai_0 == 0)) {
                     Li_20 = OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), slippage, Red);
                     if (Li_20) Comment("", OrderTicket(), "", OrderProfit(), "     ", TimeToStr(TimeCurrent(), TIME_SECONDS));
                  }
                  if (cmd_12 == OP_BUYSTOP && (Ai_0 == 1 || Ai_0 == 0)) Li_20 = OrderDelete(OrderTicket());
                  if (cmd_12 == OP_SELLSTOP && (Ai_0 == -1 || Ai_0 == 0)) Li_20 = OrderDelete(OrderTicket());
                  if (!Li_20) {
                     error_4 = GetLastError();
                     if (error_4 >= 2/* COMMON_ERROR */) {
                        if (error_4 == 129/* INVALID_PRICE */) {
                           Comment("", TimeToStr(TimeCurrent(), TIME_SECONDS));
                           RefreshRates();
                           continue;
                        }
                        if (error_4 == 146/* TRADE_CONTEXT_BUSY */) {
                           if (!(IsTradeContextBusy())) continue;
                           Sleep(2000);
                           continue;
                        }
                        Comment("", error_4, "", OrderTicket(), "     ", TimeToStr(TimeCurrent(), TIME_SECONDS));
                     }
                  }
               }
            }
         }
         count_16 = 0;
         for ( pos_24 = 0; pos_24 < OrdersTotal(); pos_24++) {
            if (OrderSelect(pos_24, SELECT_BY_POS)) {
               if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) {
                  cmd_12 = OrderType();
                  if ((cmd_12 == OP_BUYSTOP || cmd_12 == OP_BUY) && (Ai_0 == 1 || Ai_0 == 0)) count_16++;
                  if ((cmd_12 == OP_SELLSTOP || cmd_12 == OP_SELL) && (Ai_0 == -1 || Ai_0 == 0)) count_16++;
               }
            }
         }
         if (count_16 == 0) break;
         Li_8++;
         if (Li_8 > 10) {
            Alert(Symbol(), "", count_16);
            return (0);
         }
         Sleep(1000);
         RefreshRates();
         if (!bReal || Key == 5 * G_acc_number_240 - Gi_236) continue;
         break;
      }
   }
   return (1);
}

// FE4419DB9A392D72907855C4B2F09487
int f0_3(bool Ai_0, int Ai_4, int Ai_8) {
   if (Ai_0) return (Ai_4);
   return (Ai_8);
}

// 8B73C0300B4783F354728356BF7636BE
double f0_2(int Ai_0, double Ad_4, double A_pips_12) {
   double price_20 = 0;int Li_32 = 1;
   if (A_pips_12 > 2.0) {
      if (Ai_0 == 1) price_20 = NormalizeDouble(Ad_4 - A_pips_12 * Point, Digits);
      else price_20 = NormalizeDouble(Ad_4 + A_pips_12 * Point, Digits);
   } else {
      if (A_pips_12 == 2.0) {
         if (Ai_0 == 1) {int Li_28 = 1;
            for ( Li_28 = 1; Li_28 < 100; Li_28++) {
               price_20 = iFractals(Symbol(), TF_Tralling, MODE_LOWER, Li_28);
               if (price_20 != 0.0) {
                  price_20 -= NormalizeDouble(delta * Point, Digits);
                  if (Ad_4 - stopLevel * Point > price_20) break;
               } else price_20 = 0;
            }
            ObjectDelete("FR Buy");
            ObjectCreate("FR Buy", OBJ_ARROW, 0, Time[Li_28], price_20 + Point, 0, 0, 0, 0);
            ObjectSet("FR Buy", OBJPROP_ARROWCODE, 218);
            ObjectSet("FR Buy", OBJPROP_COLOR, Red);
         }
         if (Ai_0 == -1) {
            for ( Li_32 = 1; Li_32 < 100; Li_32++) {
               price_20 = iFractals(Symbol(), TF_Tralling, MODE_UPPER, Li_32);
               if (price_20 != 0.0) {
                  price_20 += NormalizeDouble(delta * Point, Digits);
                  if (Ad_4 + stopLevel * Point < price_20) break;
               } else price_20 = 0;
            }
            ObjectDelete("FR Sell");
            ObjectCreate("FR Sell", OBJ_ARROW, 0, Time[Li_32], price_20, 0, 0, 0, 0);
            ObjectSet("FR Sell", OBJPROP_ARROWCODE, 217);
            ObjectSet("FR Sell", OBJPROP_COLOR, Red);
         }
      }
      if (A_pips_12 == 1.0) {
         if (Ai_0 == 1) { Li_28 = 1;
            for ( Li_28 = 1; Li_28 < 500; Li_28++) {
               price_20 = NormalizeDouble(iLow(Symbol(), TF_Tralling, Li_28) - delta * Point, Digits);
               if (price_20 != 0.0) {
                  if (Ad_4 - stopLevel * Point > price_20) break;
                  price_20 = 0;
               }
            }
            ObjectDelete("FR Buy");
            ObjectCreate("FR Buy", OBJ_ARROW, 0, iTime(Symbol(), TF_Tralling, Li_28), price_20 + Point, 0, 0, 0, 0);
            ObjectSet("FR Buy", OBJPROP_ARROWCODE, 159);
            ObjectSet("FR Buy", OBJPROP_COLOR, Red);
         }
         if (Ai_0 == -1) {
            for (Li_32 = 1; Li_32 < 500; Li_32++) {
               price_20 = NormalizeDouble(iHigh(Symbol(), TF_Tralling, Li_32) + delta * Point, Digits);
               if (price_20 != 0.0) {
                  if (Ad_4 + stopLevel * Point < price_20) break;
                  price_20 = 0;
               }
            }
            ObjectDelete("FR Sell");
            ObjectCreate("FR Sell", OBJ_ARROW, 0, iTime(Symbol(), TF_Tralling, Li_32), price_20, 0, 0, 0, 0);
            ObjectSet("FR Sell", OBJPROP_ARROWCODE, 159);
            ObjectSet("FR Sell", OBJPROP_COLOR, Red);
         }
      }
   }
   if (Ai_0 == 1) {
      if (price_20 != 0.0) {
         ObjectDelete("SL Buy");
         ObjectCreate("SL Buy", OBJ_ARROW, 0, Time[0] + 60 * Period(), price_20, 0, 0, 0, 0);
         ObjectSet("SL Buy", OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
         ObjectSet("SL Buy", OBJPROP_COLOR, Blue);
      }
      if (stopLevel > 0) {
         ObjectDelete("STOPLEVEL-");
         ObjectCreate("STOPLEVEL-", OBJ_ARROW, 0, Time[0] + 60 * Period(), Ad_4 - stopLevel * Point, 0, 0, 0, 0);
         ObjectSet("STOPLEVEL-", OBJPROP_ARROWCODE, 4);
         ObjectSet("STOPLEVEL-", OBJPROP_COLOR, Blue);
      }
   }
   if (Ai_0 == -1) {
      if (price_20 != 0.0) {
         ObjectDelete("SL Sell");
         ObjectCreate("SL Sell", OBJ_ARROW, 0, Time[0] + 60 * Period(), price_20, 0, 0, 0, 0);
         ObjectSet("SL Sell", OBJPROP_ARROWCODE, SYMBOL_RIGHTPRICE);
         ObjectSet("SL Sell", OBJPROP_COLOR, Pink);
      }
      if (stopLevel > 0) {
         ObjectDelete("STOPLEVEL+");
         ObjectCreate("STOPLEVEL+", OBJ_ARROW, 0, Time[0] + 60 * Period(), Ad_4 + stopLevel * Point, 0, 0, 0, 0);
         ObjectSet("STOPLEVEL+", OBJPROP_ARROWCODE, 4);
         ObjectSet("STOPLEVEL+", OBJPROP_COLOR, Pink);
      }
   }
   return (price_20);
}

// 3A62B06A167CFF5D9B2988F1B53DA68C
int f0_0(int Ai_0) {
   if (Ai_0 > 43200) return (0);
   if (Ai_0 > 10080) return (43200);
   if (Ai_0 > 1440) return (10080);
   if (Ai_0 > 240) return (1440);
   if (Ai_0 > 60) return (240);
   if (Ai_0 > 30) return (60);
   if (Ai_0 > 15) return (30);
   if (Ai_0 > 5) return (15);
   if (Ai_0 > 1) return (5);
   if (Ai_0 == 1) return (1);
   if (Ai_0 == 0) return (Period());
   return (0);
}


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|量化魔方 ( 陕ICP备2025062059号-3 )|网站地图

GMT+8, 2026-9-9 01:06 , Processed in 0.139434 second(s), 5 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表