扭曲和转动,iMA的试图欺骗 - 页 9

 
imtochukwu:

弗拉基米尔,想出了办法,让它运行。我在哪里可以将卖出订单 与买入订单交换?

每个信号模块有两个功能,用于发出买入或卖出信号。这些是 "LongCondition "和 "ShortCondition"。
 
Vladimir Karputov:

每个信号模块有两个功能,用于发出买入或卖出信号。这些是 "LongCondition "和 "ShortCondition"。


我理解,在你的EA中,这些是。

int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
//+------------------------------------------------------------------+
//| "Voting" that price will fall.                                   |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
  {
   int result=0;
   int idx   =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
//+------------------------------------------------------------------+‌

而在这里,对行动负责的界限是什么?我又该如何改变这个属性?

 
imtochukwu:


我理解,在你的EA中,这是。

int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
//+------------------------------------------------------------------+
//| "Voting" that price will fall.                                   |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
  {
   int result=0;
   int idx   =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
//+------------------------------------------------------------------+‌

而在这里,对行动负责的界限是什么?我又该如何改变这个属性?

请正确插入代码:在论坛中正确插入代码

你引用的代码不是来自代码,而是来自SIGNALS模块。

你不需要改变我的模块中的任何东西来改变信号方向,因为它有 "反转 "设置--取决于它的值(真或假),信号可以直接反转。

使用 "LongCondition "的例子。

如果反向("m_reverse")为真,并且收盘价减去指标值大于零-那么我们给出信号 "长"(买入)。

int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
 
Vladimir Karputov:

请正确插入代码:在论坛中正确插入代码

你没有粘贴ADVISOR的代码,而是粘贴了SIGNAL MODULE的代码。

在我的模块中,你不需要改变任何东西来改变信号的方向,因为它有 "反转 "设置--取决于它的值(真或假),信号可以直接反转。

使用 "LongCondition "的例子。

如果 "m_reverse "为真,并且收盘价减去指标值大于零-那么信号为 "Long"(买入,买入)

int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }

弗拉基米尔,有一个新问题。你的专家顾问已经编译好了,但是当我试图把它拖到图表上并同意设置时。我看到右上角有一个图标,显示专家顾问已经启动。然后它就一下子消失了。原因可能是什么?这个反面是个好例子。如何将其应用于其他EA?
 
imtochukwu:

弗拉基米尔,有一个新问题。你的EA已经编译好了,但是当我试图把它拖到图表上并同意设置。我看到右角有一个图标,说是EA正在运行一段时间。然后它就一下子消失了。原因可能是什么?这个反面是个好例子。如何将其应用于其他EA?

在终端的 "工具箱 "窗口的 "专家 "和 "日志 "标签中寻找错误信息...
 

我知道这是负责在SignalMA.mqh文件中 "价格将上涨 "时开仓 的部分?

//+------------------------------------------------------------------+
//| "Voting" that price will grow.                                   |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx   =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(DiffCloseMA(idx)<0.0)
     {
      //--- the close price is below the indicator
      if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
        {
         //--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
         result=m_pattern_1;
         //--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
         m_base_price=0.0;
        }
     }
   else
     {
      //--- the close price is above the indicator (the indicator has no objections to buying)
      if(IS_PATTERN_USAGE(0))
         result=m_pattern_0;
      //--- if the indicator is directed upwards
      if(DiffMA(idx)>0.0)
        {
         if(DiffOpenMA(idx)<0.0)
           {
            //--- if the model 2 is used
            if(IS_PATTERN_USAGE(2))
              {
               //--- the open price is below the indicator (i.e. there was an intersection)
               result=m_pattern_2;
               //--- suggest to enter the market at the "roll back"
               m_base_price=m_symbol.NormalizePrice(MA(idx));
              }
           }
         else
           {
            //--- if the model 3 is used and the open price is above the indicator
            if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
              {
               //--- the low price is below the indicator
               result=m_pattern_3;
               //--- consider that this is a formed "piercing" and suggest to enter the market at the current price
               m_base_price=0.0;
              }
           }
        }
     }
//--- return the result
   return(result);
  }


如果你用你的模块中的代码替换这个,会不会正常工作。问题是,内容与你的略有不同。这里有更多的代码......嗯。

 
imtochukwu:

我知道这是负责在SignalMA.mqh文件中 "价格将上涨 "时开仓 的部分?

//+------------------------------------------------------------------+
//| "Voting" that price will grow.                                   |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx   =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(DiffCloseMA(idx)<0.0)
     {
      //--- the close price is below the indicator
      if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
        {
         //--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
         result=m_pattern_1;
         //--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
         m_base_price=0.0;
        }
     }
   else
     {
      //--- the close price is above the indicator (the indicator has no objections to buying)
      if(IS_PATTERN_USAGE(0))
         result=m_pattern_0;
      //--- if the indicator is directed upwards
      if(DiffMA(idx)>0.0)
        {
         if(DiffOpenMA(idx)<0.0)
           {
            //--- if the model 2 is used
            if(IS_PATTERN_USAGE(2))
              {
               //--- the open price is below the indicator (i.e. there was an intersection)
               result=m_pattern_2;
               //--- suggest to enter the market at the "roll back"
               m_base_price=m_symbol.NormalizePrice(MA(idx));
              }
           }
         else
           {
            //--- if the model 3 is used and the open price is above the indicator
            if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
              {
               //--- the low price is below the indicator
               result=m_pattern_3;
               //--- consider that this is a formed "piercing" and suggest to enter the market at the current price
               m_base_price=0.0;
              }
           }
        }
     }
//--- return the result
   return(result);
  }


如果你用你的模块中的代码替换这个,会不会正常工作。问题是,内容与你的略有不同。这里有更多的代码......嗯。


如果你只是把我的代码粘贴在这里,它不会起作用。
 
Vladimir Karputov:

如果你只是把我的代码粘贴在这里,它不会起作用。

弗拉基米尔-卡尔普托夫

如果你只是把我的代码粘贴在这里--它不会工作。


弗拉基米尔,我们应该把反面粘贴在哪里才行?

很明显,你将需要创建一个文件的副本,并改变这个inlude的名称。

 

如果你想把标准信号模块中的信号改为反向。

  • 用不同的名字创建一个文件的副本
  • 改变模块描述

// wizard description start
//+------------------------------------------------------------------+
//| Description of the class                                         |
//| Title=***          |
//| Type=SignalAdvanced                                              |
//| Name=Moving Average                                              |

  • 只需改变函数名称:LongCondition <--> ShortCondition

 
Vladimir Karputov:

如果你想把标准信号模块中的信号改为反向。

  • 用不同的名字创建一个文件的副本
  • 改变模块描述

// wizard description start
//+------------------------------------------------------------------+
//| Description of the class                                         |
//| Title=***          |
//| Type=SignalAdvanced                                              |
//| Name=Moving Average                                              |

  • 只需改变函数名称:LongCondition <--> ShortCondition


弗拉基米尔,谢谢你,你给了我很大的帮助。现在的问题是,如何制定EA下的获利 和止损订单。我怎样才能使它们受到限制?
原因: