任何菜鸟问题,为了不给论坛添乱。专业人士,不要路过。没有你就无处可去 - 6. - 页 98

 
Roger:

我不相信,这个EA在真实网站和测试器中都不能工作。


为什么?有什么错误吗?解释一下。

这只是负责将水平线 转换为订单的代码的一部分。

 
请帮助。如何使EA在离零点20-30个柱子的距离内进行优化。在图表的最后,......
 

帮助理解该指标,我不明白为什么在信号显示过程中没有实时显示,而只有当你切换时间框架时才显示,在可视化测试器中,一切都呈现出它应该有的样子。

更新前http://charts.mql5.com/2/379/eurusd-m-m1-roboforex.png

http://charts.mql5.com/2/379/eurusd-m-m1-roboforex-2.png 之后

//+------------------------------------------------------------------+
//|                                                           t27_zz |
//|                                                          tommy27 |
//|                                        SKYPE:       t.o.m.m.y.27 |
//|                                        MAIL: tommy27fx@gmail.com |
//+------------------------------------------------------------------+
#property copyright "tommy27"
#property link      "tommy27fx@gmail.com"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 FireBrick

extern int DeepBars = 5000;
double buf_1[];
double buf_2[];
//+------------------------------------------------------------------+
//| Функция инициализации, запускается один раз                      |
//+------------------------------------------------------------------+
int init() 
  {
   SetIndexBuffer(0,buf_1);
   SetIndexBuffer(1,buf_2);

   SetIndexStyle (0,DRAW_ARROW, STYLE_SOLID, 2);
   SetIndexStyle (1,DRAW_ARROW, STYLE_SOLID, 2);
   SetIndexArrow (0,108);
   SetIndexArrow (1,108);

   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   IndicatorShortName("t27_zz");
   return(0);
  }
//+------------------------------------------------------------------+
//| Основная Функция, запускается на каждом тике                     |
//+------------------------------------------------------------------+
int start() 
  {
   if (Bars <= 100) return(0);
   int ExtCountedBars = IndicatorCounted();
   if (ExtCountedBars < 0) return(-1);
   if (ExtCountedBars > 0) ExtCountedBars--;
   for (int i=DeepBars-ExtCountedBars-1; i>=0; i--)
     { 
      if (Bar1(i)==1)   buf_1[i+1] = Low[i+1]-5*Point;//UP
      if (Bar1(i)==2)   buf_2[i+1] = High[i+1]+5*Point;//DOWN
     }
   return(0);
  }
//---- end
//------------------------------------------------------------------------
int Bar1(int i)
{
 if(Low[i+1] <= Low[i+2] && Low[i+1] <= Low[i])//UP
  return(1);
 if(High[i+1] >= High[i+2] && High[i+1] >= High[i])//DOWN
  return(2);
 return(0);
} 
 
tommy27:

帮助理解该指标,我不明白为什么在信号显示期间不能实时显示,而只有当你切换时间框架时,在可视化测试器中才会呈现出应有的状态。



我必须处理DeepBars的变量。

 
splxgf:


处理变量DeerBars。


非常感谢您!删除了DeerBars,一切都正常了,那你能不能告诉我如何正确设置显示深度,现在用什么来代替 DeerBars
 

为什么要换掉它?

if (ExtCountedBars > 0) ExtCountedBars--;
int recalc=Bars-ExtCountedBars;//добавить
for (int i=recalc; i>=0; i--)//поправить
 
splxgf:

为什么要换掉它?


是的,我是这样纠正的。

if (ExtCountedBars > 0) ExtCountedBars--;
   for (int i=Bars-ExtCountedBars-1; i>=0; i--)

而对于DeepBars,我想设置条数,不显示整个故事,而是在最后一个DeepBars上显示--由于某些原因,我无法做到这一点。

 
<br / translate="no">

对于DeepBars,我想设置条数,所以它不会显示整个历史,但会显示最后的DeepBars--由于某些原因,它不能这样做。


if (ExtCountedBars > 0) ExtCountedBars--;
int recalc=Bars-ExtCountedBars;
if (recalc>DeepBars) recalc=DeepBars;
 
非常感谢你的帮助,你给了我很大的帮助。
 
Dozol:


为什么?有什么错误吗?解释一下。

这只是代码的一部分,负责将水平线转换为订单。

根据你的代码,该线将在第一个tick后被删除,也就是说,没有价格跟踪功能,它像一个脚本一样工作--你手动画一条水平线,一个订单被打开或没有,但该线被立即删除。通过这个代码的Sellstop订单将永远不会打开。