有您的持续关注
我们会做得更好

趋势短线EA WalkByTrend



WalkByTrend EA根据均线信号在进行短线交易。

本网收集整理智能交易EA仅为MQL4编程爱好者提供语法及相关编程技巧的学习研究之用,智能交易存在极高的风险测试请用模拟盘,请勿用于实盘。WalkByTrend EA源码:

//+------------------------------------------------------------------+
//|                                                  WalkByTrend.mq4 |
//|                                  Copyright @2008, ForexSoft Team |
//+------------------------------------------------------------------+
#property copyright "Copyright @2008, ForexSoft Team"
#property link      "http://forexsoft.us"

extern double TP = 100.0;
extern double SL = 370.0;
extern int bars = 15;
extern bool testLot = FALSE;
extern double MaxRisk = 1.0;
double gd_108;
double gd_116;
double g_ima_124;
double g_ima_132;
double gda_140[1];
double gd_144;
double gd_152;
int gi_160;
bool gi_164;
int gi_168;
int gi_172;

double LotsOptimized() {
   if (testLot == FALSE) {
      gd_108 = NormalizeDouble(AccountFreeMargin() * MaxRisk / 10000.0, 1);
      if (gd_108 < 0.1) gd_108 = 0.1;
      if (gd_108 > 100.0) gd_108 = 100;
   } else gd_108 = 0.1;
   return (gd_108);
}

int init() {
   if (IsTesting()) {
      gd_116 = MarketInfo(Symbol(), MODE_SPREAD) * Point;
      ObjectCreate("text_object", OBJ_LABEL, 0, 0, 0);
      ObjectSet("text_object", OBJPROP_XDISTANCE, 4);
      ObjectSet("text_object", OBJPROP_YDISTANCE, 15);
      ObjectSetText("text_object", "(c) ForexSoft Team, http://forexsoft.us", 8, "Verdana", Gold);
      ArrayInitialize(gda_140, 0.0);
   } else Alert("Demo-version runs under Strategy Tester,\nnot on account - ON HISTORY ONLY !\n\nSee full version at http://forexsoft.us");
   return (0);
}

int deinit() {
 Comment("www.125808047.com");
   return (0);
}

int start() {
   if (IsTesting()) {
      g_ima_124 = iMA(NULL, 0, 60, 0, MODE_SMA, PRICE_MEDIAN, 0);
      g_ima_132 = iMA(NULL, 0, 60, 0, MODE_SMA, PRICE_MEDIAN, 1);
      if (g_ima_124 > g_ima_132) gi_164 = TRUE;
      if (g_ima_124 < g_ima_132) gi_164 = FALSE;
      for (gi_160 = 0; gi_160 < bars; gi_160++) gda_140[gi_160] = iMA(NULL, 0, 2, 0, MODE_SMA, PRICE_MEDIAN, gi_160);
      gi_168 = ArrayMinimum(gda_140);
      gd_144 = gda_140[gi_168];
      gi_172 = ArrayMaximum(gda_140);
      gd_152 = gda_140[gi_172];
      if (OrdersTotal() == 0) {
         if (Ask <= gd_144 && gi_164 == TRUE) bool cg = OrderSend(Symbol(), OP_BUY, LotsOptimized(), Ask, 3, Ask - SL * Point, Ask + gd_116 + TP * Point, 0, 16384, 0, Blue);
         if (Bid >= gd_152 && gi_164 == FALSE) cg = OrderSend(Symbol(), OP_SELL, LotsOptimized(), Bid, 3, Bid + SL * Point, Bid - gd_116 - TP * Point, 0, 16384, 0, Red);
      }
   }
   return (0);
}

如您喜欢此文章请点下面分享按钮↴峰汇在线 » 趋势短线EA WalkByTrend
上一篇:
下一篇:
分享到:更多 ()