我如何通过试验和错误组装我的顾问 - 页 51

 
Alexsandr San:

是的!你也应该把这个添加到实用程序https://www.mql5.com/ru/code/23939


#财产版本 "1.009"

添加此功能

input string   t10="----- Price Line:     -----";                //
input string   InpFont0                     = "BUY";             // Obj: BUY (Obj:Name) ВЕРХУ
input ENUM_TRADE_COMMAND InpCSCommand       = close_open_b;      // Obj:  command:
input string   InpFont1                     = "SELL";            // Obj: SELL (Obj:Name) ВНИЗУ
input ENUM_TRADE_COMMAND InCSCommand        = close_open_s;      // Obj:  command:
input string   InpFont2                     = "LOW Up";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW Down";        // Obj: Name Price Line SELL
input ushort   InpIndentUp                  = 5;                 // Indent up, in pips (1.00045-1.00055=1 pips)
input ushort   InpIndentDown                = 10;                // Indent down, in pips (1.00045-1.00055=1 pips)
input int      InpSeconds                   = 3;                 // Number of seconds

指标下,需要一个名字--LOW

input string   InpFont2                     = "LOW Up";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW Down";        // Obj: Name Price Line SELL
附加的文件:
 
Alexsandr San:

#财产版本 "1.009"

我已经添加了这个函数

指标下,需要一个名字--LOW

忘了!停用该功能

#财产版本 "1.010"

input string   InpFont2                     = "LOW Up";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW Down";        // Obj: Name Price Line SELL
input ushort   InpIndentUp                  = 5;                 // Indent up, in pips (1.00045-1.00055=1 pips)
input ushort   InpIndentDown                = 10;                // Indent down, in pips (1.00045-1.00055=1 pips)
input int      InpSeconds                   = 3;                 // Number of seconds
input bool     InpOnTimer                   = false;             // OnTimer "LOW Up" "LOW Down"
附加的文件:
 

这个工具能做什么!?- 是的!几乎所有的东西,你所有的幻想都在其中。

GBPUSDM30

 
Alexsandr San:

这个工具能做什么!?- 是的!几乎所有的东西,你所有的幻想都在其中。

如果价格到了一个交叉点,那么肯定是))))。

 
Alexsandr San:

这个工具能做什么!?- 是的!几乎所有的东西,你所有的幻想都在其中。

我要求在这个实用程序中还有一个功能--拖网,在水平蓝线后面

要求提供该实用程序 1

快照2 2

在这里,我手动移动黄色水平线,并触发了一个停止。

快照3 3

 
Alexsandr San:

本实用新型要求的是另一个功能--拖网,在蓝色横线后面

1

2

在这里,我手动移动了黄色的水平线,并触发了一个停止。

3

它在水平线后面--还有待观察,在指标Low_Macd_Line.mq5 中做了哪些计算 ,以便在蓝色的后面拖动。

图片来源

在图片中--顶部的蓝色,触及上部的黄色,触发信号。

而下层的蓝色,接触到下层的黄色,触发了信号

 
Alexsandr San:

它在水平线后面--还有待观察Low_Macd_Line.mq5 指标中的哪种计算方法, ,在蓝色的后面拖动。

在图片中--顶部的蓝色,触及上部的黄色,触发信号。

而下层的蓝色,接触到下层的黄色,触发了信号

能够修复指标窗口中的拖网Low_Macd_Line.mq5的工作--现在在星期一,要把它弄好并更新实用程序

射击4

------------------------

这里是拖网本身

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTickObjTrailingCS(void)
  {
//---
   if(InpSignalsFrequency>=10) // trailing no more than once every 10 seconds
     {
      datetime time_current=TimeCurrent();
      if(time_current-m_obj_last_trailingCS>10)
        {
         if(RefreshRates())
            ObjTrailingCS();
         else
            return;
         m_obj_last_trailingCS=time_current;
        }
     }
//--- we work only at the time of the birth of new bar
   datetime time_0=iTime(m_symbol.Name(),Period(),0);
   if(time_0==m_prev_barsCS)
      return;
   m_prev_barsCS=time_0;
   if(InpSignalsFrequency<10) // trailing only at the time of the birth of new bar
     {
      if(RefreshRates())
         ObjTrailingCS();
     }
  }
//+------------------------------------------------------------------+
//| Object Trailing                                                  |
//|   InpObjTrailingStop: min distance from price to object          |
//+------------------------------------------------------------------+
void ObjTrailingCS(void)
  {
   double new_up_price        = -1;   //
   double new_down_price      = 1;   //
   double current_up_price    = ObjectGetDouble(0,InpFont0,OBJPROP_PRICE);
   double current_down_price  = ObjectGetDouble(0,InpFont1,OBJPROP_PRICE);
   double price_up            = ObjectGetDouble(0,InpFont2,OBJPROP_PRICE);
   double price_down          = ObjectGetDouble(0,InpFont3,OBJPROP_PRICE);

   if(current_up_price>new_up_price)
     {
      if(current_up_price>price_up+InpObjTrail)
        {
         m_obj_up_priceCS=price_up+InpObjTrail;
         HLineMove(0,InpFont0,m_obj_up_priceCS);
        }
     }
   if(current_down_price<new_down_price)
     {
      if(current_down_price<price_down-InpObjTrail)
        {
         m_obj_down_priceCS=price_down-InpObjTrail;
         HLineMove(0,InpFont1,m_obj_down_priceCS);
        }
     }
  }
//+------------------------------------------------------------------+
 
Alexsandr San:

设法让Low_Macd_Line.mq5 指标窗口中的拖网工作--现在在星期一,把它做好,并更新实用程序。

------------------------

这里是拖网本身

也许有人会有兴趣在测试器中玩这个功能--我粘贴的是实用程序,它纯粹是为了测试器,你还需要这个指标Low_Macd_Line.mq5

的函数本身。

input string   t10="----- Price Line:     -----";                //
input string   InpFont0                     = "BUY";             // Obj: BUY (Obj:Name) ВЕРХУ
input ENUM_TRADE_COMMAND InpCSCommand       = close_open_b;      // Obj:  command:
input string   InpFont1                     = "SELL";            // Obj: SELL (Obj:Name) ВНИЗУ
input ENUM_TRADE_COMMAND InCSCommand        = close_open_s;      // Obj:  command:
input double   InpObjTrail                  = 0.0001;            // Obj: Trailing Stop MACD
input double   InpObjTrailStep              = 0.0001;            // Obj: Trailing Step MACD
input ushort   InpObjTrailingStopCS         = 15;                // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStepCS         = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   InpFont2                     = "LOW Up";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW Down";        // Obj: Name Price Line SELL
input ushort   InpIndentUp                  = 5;                 // Indent up, in pips (1.00045-1.00055=1 pips)
input ushort   InpIndentDown                = 10;                // Indent down, in pips (1.00045-1.00055=1 pips)
input int      InpSeconds                   = 3;                 // Number of seconds
input bool     InpOnTimer                   = true;              // OnTimer "LOW Up" "LOW Down"

当从指标 Low_Macd_Line.mq5,你需要设置这些水平线,一个名称为"LOW"

input string   InpFont2                     = "LOW Up";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW Down";        // Obj: Name Price Line SELL
附加的文件:
02_llliiiooo.mq5  255 kb
 
Alexsandr San:

本实用程序还应该增加一个功能--拖网,在蓝色水平线后面

#财产版本 "1.011"

拖曳臂应该为每个货币对调整(对于XAU/USD的1小时),一分钟0.1001

英镑兑美元的 一分钟内,0.0001

input double   InpObjTrail                  = 1.0001;            // Obj: Trailing Stop MACD ("0" -> Off)
input double   InpObjTrailStep              = 1.0001;            // Obj: Trailing Step MACD

最重要的是--在使用指标时 Low_Macd_Line.mq5

你必须正确输入水平线的名称(有两个)--这是非常重要的!!。指标 Low_Macd_Line.mq5在图表上的指标的1个窗口中会是什么?

input string   InpFont2                     = "LOW Up";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW Down";        // Obj: Name Price Line SELL

它必须是这样的!

input string   InpFont2                     = "LOW";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW";          // Obj: Name Price Line SELL

GBPUSDM1XX 1.

GBPUSDM1YY 2.

GBPUSDM1YY1 3.

GBPUSDM1YY2 4.

在图片中--拖网工作并改变了方向--现在你要手动,再次设置卖出的水平线--以防再次改变方向。

附加的文件:
 
Alexsandr San:

#财产版本 "1.011"

拖曳臂应该为每个货币对调整(对于XAU/USD的1小时),一分钟0.1001

英镑兑美元的 一分钟内,0.0001

最重要的是 - 当指标 Low_Macd_Line.mq5

需要正确输入水平线的名称(有两条)--更重要的是指标 Low_Macd_Line.mq5在图表上的指标的1个窗口中会是什么?

#财产版本 "1.012"

稍微完善一下功能

input string   t0="----- Price Line:        -----";              //
input string   InpFont0                     = "BUY";             // Obj: BUY (Obj:Name) ВЕРХУ
input ENUM_TRADE_COMMAND InpCSCommand       = close_open_b;      // Obj:  command:
input string   InpFont1                     = "SELL";            // Obj: SELL (Obj:Name) ВНИЗУ
input ENUM_TRADE_COMMAND InCSCommand        = close_open_s;      // Obj:  command:
input double   InpObjTrail                  = 1.0001;            // Obj: Trailing Stop MACD ("0" -> Off)
input double   InpObjTrailStep              = 1.0001;            // Obj: Trailing Step MACD
input bool     InpDub                       = false;             // "0.0":Price=false(Trail->Off) "LOW":Price=true(Trail->ON)
input bool     InpDubll                     = false;             // Duplicate "BUY""SELL" (ObjTrailStep)
input ushort   InpObjTrailingStopCS         = 15;                // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStepCS         = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   InpFont2                     = "LOW Up";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW Down";        // Obj: Name Price Line SELL
input bool     InpOnTimer                   = false;             // OnTimer "LOW Up" "LOW Down"
input ushort   InpIndentUp                  = 5;                 // Indent up, in pips (1.00045-1.00055=1 pips)
input ushort   InpIndentDown                = 10;                // Indent down, in pips (1.00045-1.00055=1 pips)

触发后,水平线SELL开仓并显示水平线BUY,反之亦然。

此外,线被设置为从"0" 开始,距离由Obj: Trailing Step MACD 设置。

或从水平线"LOW " 开始。


input double   InpObjTrailStep              = 1.0001;            // Obj: Trailing Step MACD
input bool     InpDub                       = false;             // "0.0":Price=false(Trail->Off) "LOW":Price=true(Trail->ON)
input bool     InpDubll                     = false;             // Duplicate "BUY""SELL" (ObjTrailStep)

FromTimer "LOW Up""LOW Down "相同,只有距离被设定(输入 ushort InpObjTrailingStepCS = 5;//Obj: 追踪步骤,单位是点(1.00045-1.00055=1 点)。

input ushort   InpObjTrailingStepCS         = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   InpFont2                     = "LOW Up";          // Obj: Name Price Line BUY
input string   InpFont3                     = "LOW Down";        // Obj: Name Price Line SELL
input bool     InpOnTimer                   = false;             // OnTimer "LOW Up" "LOW Down"

如何知道在指标 Low_Macd_Line.mq5 中设置的 水平线的距离 (对每一对,不同的距离)。

复制并粘贴在实用程序设置中

input double   InpObjTrailStep              = 1.0001;            // Obj: Trailing Step MACD

图片来源

在图片中,"0"到水平买入 0.0064,当它触及水平低点时,水平卖出将被设置(仅低于"0"-0.0064)。

重要的是!!不要在数字前面加上减号(-),我们将其输入到实用程序中。

快照2 该函数的变体之一

附加的文件: