顺水外汇EA交易网MT4

标题: 求大神给改一下指标 [打印本页]

作者: Fell._AMr1C    时间: 2018-1-11 13:23
标题: 求大神给改一下指标
网上下的指标,这个指标不会自己更新啊,今天加载之后,明天再看还是昨天的位置,重新加载位置就变了,,,,,而且 保存模板之后,换品种加载模板,竟然什么都不显示。
//+------------------------------------------------------------------+
//|                                              DinapoliTargets.mq4 |
//|                                            mishanya_fx@yahoo.com |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "mishanya"
#property link      "mishanya_fx@yahoo.com"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue
//---- input parameters
extern int       barn=300;
extern int       Length=6;
//---- buffers
double ExtMapBuffer1[];
//double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexEmptyValue(0,0.0);
  //SetIndexDrawBegin(0, barn);
   //SetIndexStyle(0,DRAW_SECTION);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   ObjectDelete("Start line");
   ObjectDelete("Stop line");
   ObjectDelete("Target1 line");
   ObjectDelete("Target2 line");
   ObjectDelete("Target3 line");
   ObjectDelete("Fantasy line");
   ObjectDelete("CrazyDream line");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int shift,Swing,Swing_n,uzl,i,zu,zd,mv;
   double PointA,PointB,PointC,Target1,Target2,Target3,Fantasy,CrazyDream,Start,Stop;
   double LL,HH,BH,BL,NH,NL;
   double Uzel[10000][3];
   string text;
// loop from first bar to current bar (with shift=0)
      Swing_n=0;Swing=0;uzl=0;
      BH =High[barn];BL=Low[barn];zu=barn;zd=barn;
for (shift=barn;shift>=0;shift--) {
      LL=10000000;HH=-100000000;
   for (i=shift+Length;i>=shift+1;i--) {
         if (LowHH) {HH=High;}
   }
   if (Low[shift]HH){
      Swing=2;
      if (Swing_n==1) {zu=shift+1;}
      if (Swing_n==-1) {zd=shift+1;}
   } else {
      if (Low[shift]HH) {Swing=1;}
   }
   if (Swing!=Swing_n && Swing_n!=0) {
   if (Swing==2) {
      Swing=-Swing_n;BH = High[shift];BL = Low[shift];
   }
      uzl=uzl+1;
   if (Swing==1) {
      Uzel[uzl][1]=zd;
      Uzel[uzl][2]=BL;
   }
   if (Swing==-1) {
      Uzel[uzl][1]=zu;
      Uzel[uzl][2]=BH;
   }
      BH = High[shift];
      BL = Low[shift];
   }
   if (Swing==1) {
      if (High[shift]>=BH) {BH=High[shift];zu=shift;}}
      if (Swing==-1) {
          if (Low[shift]
[attach]17876[/attach]
ointC)
{
Start= NormalizeDouble((PointB-PointA)*0.318+PointC,4)+(Ask-Bid);
Stop=PointC-2*(Ask-Bid);
}
   if (ObjectFind("Start Line") != 0)
     {
      ObjectCreate("Start line",OBJ_HLINE,0,Time[0],Start);
      ObjectSet("Start line",OBJPROP_COLOR,Honeydew);
      ObjectSet("Start line",OBJPROP_WIDTH,1);
      ObjectSet("Start line",OBJPROP_STYLE,STYLE_DOT);
     }
     else
     {
     ObjectMove("Start line", 0,Time[0],Start);
     }
   if (ObjectFind("Stop Line") != 0)
     {
      ObjectCreate("Stop line",OBJ_HLINE,0,Time[0],Stop);
      ObjectSet("Stop line",OBJPROP_COLOR,Red);
      ObjectSet("Stop line",OBJPROP_WIDTH,1);
      ObjectSet("Stop line",OBJPROP_STYLE,STYLE_DOT);
     }
     else
     {
     ObjectMove("Stop line", 0,Time[0],Stop);
     }
    if (ObjectFind("Target1 Line") != 0)
     {
      ObjectCreate("Target1 line",OBJ_HLINE,0,Time[0],Target1);
      ObjectSet("Target1 line",OBJPROP_COLOR,Green);
      ObjectSet("Target1 line",OBJPROP_WIDTH,1);
      ObjectSet("Target1 line",OBJPROP_STYLE,STYLE_DOT);
     }
     else
     {
     ObjectMove("Target1 line", 0,Time[0],Target1);
     }
    if (ObjectFind("Target2 Line") != 0)
     {
      ObjectCreate("Target2 line",OBJ_HLINE,0,Time[0],Target2);
      ObjectSet("Target2 line",OBJPROP_COLOR,Yellow);
      ObjectSet("Target2 line",OBJPROP_WIDTH,1);
      ObjectSet("Target2 line",OBJPROP_STYLE,STYLE_DOT);
     }
     else
     {
     ObjectMove("Target2 line", 0,Time[0],Target2);
     }
    if (ObjectFind("Target3 Line") != 0)
     {
      ObjectCreate("Target3 line",OBJ_HLINE,0,Time[0],Target3);
      ObjectSet("Target3 line",OBJPROP_COLOR,DarkOrchid);
      ObjectSet("Target3 line",OBJPROP_WIDTH,1);
      ObjectSet("Target3 line",OBJPROP_STYLE,STYLE_DOT);
     }
     else
     {
     ObjectMove("Target3 line", 0,Time[0],Target3);
     }
     if (ObjectFind("Fantasy Line") != 0)
     {
      ObjectCreate("Fantasy line",OBJ_HLINE,0,Time[0],Fantasy);
      ObjectSet("Fantasy line",OBJPROP_COLOR,Lime);
      ObjectSet("Fantasy line",OBJPROP_WIDTH,1);
      ObjectSet("Fantasy line",OBJPROP_STYLE,STYLE_DOT);
     }
     else
     {
     ObjectMove("Fantasy line", 0,Time[0],Fantasy);
     }
     if (ObjectFind("CrazyDream Line") != 0)
     {
      ObjectCreate("CrazyDream line",OBJ_HLINE,0,Time[0],CrazyDream);
      ObjectSet("CrazyDream line",OBJPROP_COLOR,DarkTurquoise);
      ObjectSet("CrazyDream line",OBJPROP_WIDTH,1);
      ObjectSet("CrazyDream line",OBJPROP_STYLE,STYLE_DOT);
     }
     else
     {
     ObjectMove("CrazyDream line", 0,Time[0],CrazyDream);     
     }
     if (Bid==Target1)
     {Alert("Target 1 Reached ", Symbol(),"!!!");
     Print("Target1=",Target1, TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS));
     }
     if (Bid==Target2)
     { Alert("Target 2 Reached ", Symbol(),"!!!");
     Print("Target2=",Target2, TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS));
     }
     if (Bid==Target3)
     { Alert("Target3 Reached ", Symbol(),"!!!");
     Print("Target3=",Target3, TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS));
     }
     if (Bid==Fantasy)
     { Alert("Fantasy Reached ", Symbol(),"!!!");
     Print("Fantasy=",Target3, TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS));
     }
     if (Bid==CrazyDream)
     { Alert("CrazyDream Reached ", Symbol(),"!!!");
     Print("CrazyDream=",Target3, TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS));
     }
   return(0);
  }
//+------------------------------------------------------------------+

作者: 双吉    时间: 2018-1-11 14:26
好复杂啊!高手来看
作者: leeyh001    时间: 2018-1-11 15:44
程序有错,二维数组当作一维数组在使用
[attach]17877[/attach]

作者: pszwgk@163.com    时间: 2018-1-11 16:57
小手一抖,金币到手
作者: Fell._AMr1C    时间: 2018-1-11 17:57

这是改好的?

作者: panda88    时间: 2018-1-11 18:22
请教大神
作者: leeyh001    时间: 2018-1-11 18:39

是的,调试完全正常

作者: linzi88    时间: 2018-1-11 20:19
dsgfgggggggggggggggggggggggggggggggggd

作者: liuchenzhang    时间: 2018-1-11 20:54
请教大神
作者: hao0502    时间: 2018-1-11 22:11
完全正常
作者: 猫咪猎人    时间: 2018-1-11 22:17
小手一抖,金币到手
作者: qw1282    时间: 2018-1-11 22:28
这指标的用法????????????????




欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/) Powered by Discuz! X3.2