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

 
Алексей Тарабанов:

你喜欢它吗?

我需要看到它在行动中

不为我,为他

[删除]  

我认为对水平线的单独、止损和盈利不够,是自动设置的。

这是再加4条线--不!8

图片来源

[删除]  
Aleksandr Klapatyuk:

我认为对水平线的单独、止损和盈利不够,是自动设置的。

这是再加4条线--不!8


#财产版本 "1.11"

设置一条水平止损线,如果价格向正确的方向移动,则平仓。

黄线是StopLoss,同时也是拖网。

悬挂

input string   t1="------ TakeProfit    ----------";    // TakeProfit
input double   InTakeProfit            = 54;            // Take Profit, in pips (1.00045-1.00055=1 pips)

它不能为零--它将立即关闭。你必须设置你想关闭多少个点的头寸。

图片来源

快照1

你必须设置你希望平仓的点数。

附加的文件:
[删除]  
2019.10.28 10:21:58.667 Your intelligence (USDJPY,H1)   zero divide in 'Your intelligence.mq5' (1481,14)

我得到这个错误,当我开仓时,专家顾问被删除了。账户是500GLD。

我还搞不清楚。

[删除]  
Aleksandr Klapatyuk:

我得到了这个错误,当我开仓时,专家顾问被删除。账户是500GLD。

我还搞不清楚。

该死!而且在搜索中没有任何信息。谁能告诉我错误是什么?

2019.10.28 10:21:58.667 你的智慧(USDJPY,H1)在'你的智慧.mq5'(1481,14)中被零除。

图片来源

 
Aleksandr Klapatyuk:

我得到了这个错误,当我开仓时,专家顾问被删除。账户是500GLD。

但在卢布账户上--一切正常。

在代码中,第1481行,第14位--寻找一个错误。

[删除]  
Vladimir Karputov:

在代码中,第1481行,第14位--寻找一个错误。

非常感谢!我想我知道原因是什么了。谢谢你的提示!!。

[删除]  
Vladimir Karputov:

在第1481行的代码中,光标位置14 - 寻找一个错误。

这里--我搞砸了。

  {
//---
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
        {
         if((PositionGetDouble(POSITION_PROFIT)/PositionGetDouble(POSITION_VOLUME)/
             SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE))/n<-InStopLoss)
            ClosePosition(m_position.Symbol());  // close a position by the specified symbo
        }
  }

把它改成了这样--只是还没有检查这个功能--但它应该是有效的

  {
//---
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
        {
         if(m_position.Commission()+m_position.Swap()+m_position.Profit()/n<-InStopLoss)
            ClosePosition(m_position.Symbol());  // close a position by the specified symbo
        }
  }

再一次--非常感谢您!健康!和所有最好的!

[删除]  

现在注意到--在终端的地方--GLD账户

开仓后利润没有变化 - 因为它显示的是8点,没有变化

价格在图表上移动--也许这就是我得到一个错误的原因。

InkedAlpari MT5_LI

[删除]  

这里 - 我搞砸了。

  {
//---
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
        {
         if((PositionGetDouble(POSITION_PROFIT)/PositionGetDouble(POSITION_VOLUME)/
             SymbolInfoDouble(Symbol(),SYMBOL_TRADE_TICK_VALUE))/n<-InStopLoss)
            ClosePosition(m_position.Symbol());  // close a position by the specified symbo
        }
  }

我把它修成了这样--只是还没有检查--但它应该是有效的。

  {
//---
   for(int i=PositionsTotal()-1; i>=0; i--) // returns the number of current positions
      if(m_position.SelectByIndex(i)) // selects the position by index for further access to its properties
        {
         if(m_position.Commission()+m_position.Swap()+m_position.Profit()/n<-InStopLoss)
            ClosePosition(m_position.Symbol());  // close a position by the specified symbo
        }
  }

我应该把它留在--我搞砸了的地方。- 它的工作!和我想纠正,不工作和/N和删除,并与它。不工作。

整个原因是GLD账户本身。在同一个终端上开了一个美元账户,一切正常。