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

 
Alexsandr San:

我知道了--我努力做到不糊涂,如果有人感兴趣,请问,我们一起想办法。

我仍然在寻找正确的方法来设置它们的工作。

//+------------------------------------------------------------------+
//| Enum Lor or Risk                                                 |
//+------------------------------------------------------------------+
enum ENUM_TRADE_COMMAND
  {
   Line_Line=0,      // Line
   Line_buy=1,       // Line+Open Buy
   Line_sell=2,      // Line+Open Sell
   close_buys=3,     // Close All Buy's
   close_sells=4,    // Close All Sell's
   close_all=5,      // Close All Buy's and Sell's
   open_buy=6,       // Open Buy
   open_sell=7,      // Open Sell
   open_buy_sell=8,  // Open Buy and Sell
  };
//+------------------------------------------------------------------+


这是你做动作的地方,你需要将逻辑设置为

   if(main[1]>signal[1])
     {
      switch(InpTradeCommandY)
        {
         case Line_Line:
            ExtNeedLine=true;
            if(Obj_line())
               break;
         case Line_buy:
            ExtNeedOpenBuy=true;
            if(LongObjOpened())
               ExtNeedLine=true;
            if(Obj_line())
               break;
         case Line_sell:
            ExtNeedOpenSell=true;
            if(ShortObjOpened())
               ExtNeedLine=true;
            if(Obj_line())
               break;
         case  close_buys:
            ExtNeedCloseBuy=true;
            if(LongObjClosed())
               break;
         case  close_sells:
            ExtNeedCloseSell=true;
            if(ShortObjClosed())
               break;
         case close_all:
            ExtNeedCloseAll=true;
            if(LongShortObjClosed())
               break;
         case open_buy:
            ExtNeedOpenBuy=true;
            if(LongObjOpened())
               break;
         case open_sell:
            ExtNeedOpenSell=true;
            if(ShortObjOpened())
               break;
         default:
            ExtNeedOpenBuySell=true;
            if(LongShortObjOpened())
               break;
        }
      PlaySound("ok.wav");
     }
   if(main[1]<signal[1])
     {
      switch(InpTradeCommandU)
        {
         case Line_Line:
            ExtNeedLine=true;
            if(Obj_line())
               break;
         case Line_buy:
            ExtNeedOpenBuy=true;
            if(LongObjOpened())
               ExtNeedLine=true;
            if(Obj_line())
               break;
         case Line_sell:
            ExtNeedOpenSell=true;
            if(ShortObjOpened())
               ExtNeedLine=true;
            if(Obj_line())
               break;
         case  close_buys:
            ExtNeedCloseBuy=true;
            if(LongObjClosed())
               break;
         case  close_sells:
            ExtNeedCloseSell=true;
            if(ShortObjClosed())
               break;
         case close_all:
            ExtNeedCloseAll=true;
            if(LongShortObjClosed())
               break;
         case open_buy:
            ExtNeedOpenBuy=true;
            if(LongObjOpened())
               break;
         case open_sell:
            ExtNeedOpenSell=true;
            if(ShortObjOpened())
               break;
         default:
            ExtNeedOpenBuySell=true;
            if(LongShortObjOpened())
               break;
        }
      PlaySound("ok.wav");
     }
//---
 

我想不通--这里有两条横线,当价格触及第一条横线时,它将被删除,而这里的第二条横线,它将保留。

- 我在戳,我在戳,我不在戳!这两个人都被删除了。

而这些线有不同的名字。

1

input string   t0="----- Trailing Line: 1   -----";              //
input string   InpObjUpName                 = "TOP";             // Obj: TOP (Horizontal Line)
input int      InpStep1                     = 20;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommand    = close_sells;       // Obj:  command:
input string   InpObjDownName               = "LOWER";           // Obj: LOWER (Horizontal Line)
input int      InpStep2                     = 20;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommand     = close_buys;        // Obj:  command:
input ushort   InpObjTrailingStop           = 30;                // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStep           = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)

2

input string   t2="----- Trailing Line: 2   -----";              //
input string   InpObjUpNameG                = "TOP G";           // Obj: TOP (Horizontal Line)
input int      InpStep3                     = 30;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommandG   = close_sells;       // Obj:  command:
input string   InpObjDownNameG              = "LOWER G";         // Obj: LOWER (Horizontal Line)
input int      InpStep4                     = 30;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommandG    = close_buys;        // Obj:  command:
input ushort   InpObjTrailingStopG          = 50;                // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStepG          = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)

也许我们需要一个不同的命令--这个命令。

                           ObjectsDeleteAll(0,InpObjUpName);

图片来源

附加的文件:
 
Alexsandr San:

我想不通--这里有两条横线,当价格触及第一条横线时,它将被删除,而这里的第二条横线,它将保留。

- 我在戳,我在戳,我不在戳!这两个人都被删除了。

而这些线有不同的名字。

1

2

也许我需要一个不同的命令--这个命令。


我手动画了一条水平线,命名为 "TOP",机器人也用同样的名字画了它--这怎么可能?

2条同名的横线

图片来源

手动绘制的水平线--机器人没有工作,但它设置的那条水平线却工作了,并删除了两条同名的水平线"TOP"

 
Alexsandr San:

我想不通--这里有两条横线,当价格触及第一条横线时,它将被删除,而这里的第二条横线,它将保留。

- 我在戳,我在戳,我不在戳!这两个人都被删除了。

而这些线有不同的名字。

1

2

也许我需要一个不同的命令--这个命令。


事实证明,这些名字非常相似,这就是为什么"TOP "和"TOP G"被删除的原因。

我在设置中给了其他的名字--现在它被删除了,因为它应该是这样的。

快照2

 
Alexsandr San:

我想明白了--原来这两个名字非常相似,这就是"TOP "和"TOP G " 被删除的原因。

我在设置中给了它一个不同的名字--现在它已经被删除了,因为它应该被删除了!


是的!它成功了- 事实证明,对象的名称应该这样设置,而不是接近于类似的

快照3

 

专家将执行任何命令,你的幻想在一个专家身上。

设置-

//+------------------------------------------------------------------+
//| Enum Lor or Risk                                                 |
//+------------------------------------------------------------------+
enum ENUM_TRADE_COMMAND
  {
   Line1_Line1=0,    // Line: LOWER
   Line2_Line2=1,    // Line: TOP
   Line_Line=2,      // Line: LOWER+Line: TOP
   close_buys=3,     // Close All Buy's
   close_sells=4,    // Close All Sell's
   close_all=5,      // Close All Buy's and Sell's
   open_buy=6,       // Open Buy
   open_sell=7,      // Open Sell
   open_buy_sell=8,  // Open Buy and Sell
  };
//+------------------------------------------------------------------+
input string   t="-----  Parameters         -----";              //
input string   Template                     = "ADX";             // Имя шаблона(without '.tpl')
input double   TargetProfit                 = 999999.99;         // Цель Баланса(Ваш Баланс + сумма)
input uint     maxLimits                    = 1;                 // Кол-во Позиции Открыть в одну сторону
input double   InpLots                      = 0.01;              // Lots
input int      InpTakeProfit                = 100;               // Take Profit ("0"-No. 5<100)
input string   t0="----- Trailing Line: 1   -----";              //
input string   InpObjUpName                 = "TOP";             // Obj: TOP (Horizontal Line)
input int      InpStep1                     = 20;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommand    = open_sell;         // Obj:  command:
input string   InpObjDownName               = "LOWER";           // Obj: LOWER (Horizontal Line)
input int      InpStep2                     = 20;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommand     = open_buy;          // Obj:  command:
input ushort   InpObjTrailingStop           = 30;                // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStep           = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   t1="----- Line name: 1       -----";              //
input string   InpNameR                     = "LineR";           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandR   = open_buy;          // Trade command:
input string   t2="----- Trailing Line: 2   -----";              //
input string   InpObjUpNameG                = "POT";             // Obj: TOP (Horizontal Line)
input int      InpStep3                     = 30;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommandG   = close_sells;       // Obj:  command:
input string   InpObjDownNameG              = "REWOL";           // Obj: LOWER (Horizontal Line)
input int      InpStep4                     = 30;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommandG    = close_buys;        // Obj:  command:
input ushort   InpObjTrailingStopG          = 50;                // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStepG          = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   t3="----- Line name: 2       -----";              //
input string   InpNameS                     = "LineS";           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandS   = open_sell;         // Trade command:
input string   t4="----- Indicators: SELL   -----";              //
input string   short_name                   = "LeMan_BrainTrend1Sig"; // Name Indicators "SELL"
input bool     InpIndicators                = true;              // Indicators: Start (true)
input ENUM_TRADE_COMMAND InpTradeCommandY   = Line2_Line2;       // Trade command: (BuyBuffer Indicators)
input ENUM_TRADE_COMMAND InpTradeCommandU   = Line1_Line1;       // Trade command: (SellBuffer Indicators)
input string   t5="----- Indicators: BUY    -----";              //
input string   short_name1                  = "LeMan_BrainTrend1Sig"; // Name Indicators "BUY"
input bool     InpIndicators1               = false;             // Indicators: Start (true)
input ENUM_TRADE_COMMAND InpTradeCommandY1  = close_buys;        // Trade command: (BuyBuffer Indicators)
input ENUM_TRADE_COMMAND InpTradeCommandU1  = Line1_Line1;       // Trade command: (SellBuffer Indicators)
input string   t6="----- Button:            -----";              //
input ENUM_TRADE_COMMAND InpTradeCommandBut = Line1_Line1;       // Obj(BUY):  command:Button: BUY
input ENUM_TRADE_COMMAND InTradeCommandBut  = Line2_Line2;       // Obj(SELL):  command:Button: SELL
input int      TrailingStop_STOP_LEVEL      = 36;                // Button: Trailing Stop LEVEL

快照2

在测试器中查看了错误 - 嗯,也是默认的结果

图片来源

附加的文件:
 

增加了更多的命令

//+------------------------------------------------------------------+
//| Enum Lor or Risk                                                 |
//+------------------------------------------------------------------+
enum ENUM_TRADE_COMMAND
  {
   Line1_Line1=0,    // Line: LOWER
   Line2_Line2=1,    // Line: TOP
   Line_Line=2,      // Line: LOWER+Line: TOP
   Line1_buys=3,     // Line: LOWER+Buy's
   Line2_sells=4,    // Line: TOP+Sell's
   close_buys=5,     // Close All Buy's
   close_sells=6,    // Close All Sell's
   close_all=7,      // Close All Buy's and Sell's
   open_buy=8,       // Open Buy
   open_sell=9,      // Open Sell
   open_buy_sell=10, // Open Buy and Sell
  };
//+------------------------------------------------------------------+

添加了这个

   Line1_buys=3,     // Line: LOWER+Buy's
   Line2_sells=4,    // Line: TOP+Sell's
附加的文件:
 

专家效用--

指示 - 这里是最重要的事情,要记住。

input string   t0="----- Trailing Line: 1   -----";              //
input string   InpObjUpName                 = "TOP";             // Obj: TOP (Horizontal Line)
input int      InpStep1                     = 25;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommand    = open_sell;         // Obj:  command:
input string   InpObjDownName               = "LOWER";           // Obj: LOWER (Horizontal Line)
input int      InpStep2                     = 25;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommand     = close_buys;        // Obj:  command:
input ushort   InpObjTrailingStop           = 0;                 // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStep           = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   t1="----- Trailing Line: 2   -----";              //
input string   InpObjUpNameG                = "POT";             // Obj: TOP (Horizontal Line)
input int      InpStep3                     = 0;                 // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommandG   = close_sells;       // Obj:  command:
input string   InpObjDownNameG              = "REWOL";           // Obj: LOWER (Horizontal Line)
input int      InpStep4                     = 0;                 // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommandG    = close_buys;        // Obj:  command:
input ushort   InpObjTrailingStopG          = 0;                 // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStepG          = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)

如果你设置了(grid step, points("0" -> false)),这些线就会被画出来,也会被追踪(如果0-不会)。

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

另外从信号指标来看--你不需要下载这些指标,我已经附在后面了,你可以自己捡起来。

input string   t2="----- Indicators: SELL   -----";              //
input string   short_name                   = "LeMan_BrainTrend1Sig"; // Name Indicators "SELL"
input bool     InpIndicators                = false;             // Indicators: Start (true)
input ENUM_TRADE_COMMAND InpTradeCommandY   = open_sell;         // Trade command: (BuyBuffer Indicators)
input ENUM_TRADE_COMMAND InpTradeCommandU   = close_sells;       // Trade command: (SellBuffer Indicators)
input string   t3="----- Indicators: BUY    -----";              //
input string   short_name1                  = "LeMan_BrainTrend1Sig"; // Name Indicators "BUY"
input bool     InpIndicators1               = false;             // Indicators: Start (true)
input ENUM_TRADE_COMMAND InpTradeCommandY1  = close_buys;        // Trade command: (BuyBuffer Indicators)
input ENUM_TRADE_COMMAND InpTradeCommandU1  = open_buy;          // Trade command: (SellBuffer Indicators)
附加的文件:
 
Alexsandr San:

专家效用--

指示 - 这里是最重要的事情,要记住。

如果你设置了(grid step, points("0" -> false)),这些线就会被画出来,也会被追踪(如果0-不会)。

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

另外从信号指标来看--你不能下载这些指标,我已经附上了,你可以自己去捡。


其中一个设置

快照3

图片来源

快照2

.set文件中的设置

附加的文件:
demo.set  4 kb
 
#property version     "1.001"

增加了一些命令

//+------------------------------------------------------------------+
//| ENUM_TRADE_COMMAND                                                 |
//+------------------------------------------------------------------+
enum ENUM_TRADE_COMMAND
  {
   Turn_Off=0,       // TURN OFF
   Line1_Line1=1,    // Line: LOWER
   Line2_Line2=2,    // Line: TOP
   Line_Line=3,      // Line: LOWER+Line: TOP
   Line1_buys=4,     // Line: LOWER+Buy's
   Line2_sells=5,    // Line: TOP+Sell's
   sells_Line1=6,    // Line: LOWER+Sell's
   buys_Line2=7,     // Line: TOP+Buy's
   close_buys=8,     // Close All Buy's
   close_sells=9,    // Close All Sell's
   close_all=10,     // Close All Buy's and Sell's
   open_buy=11,      // Open Buy
   open_sell=12,     // Open Sell
   close_open_b=13,  // Close Sell+Open Buy
   close_open_s=14,  // Close Buy+Open Sell
   open_buy_sell=15, // Open Buy and Sell
  };
//+------------------------------------------------------------------+
附加的文件:
原因: