[存档]任何菜鸟问题,为了不使论坛变得杂乱无章。专业人士,不要与它擦肩而过。没有你,哪里都不能去 - 5. - 页 46

 

如果你知道用SL计算关闭头寸 的总损失余额和开放盈利交易的总余额的功能,请来信。

损失余额的计算应从最后的最大存款价值开始

 

下午好!!!。我的功能是用四十个骂人的词来骂人--显然我不太懂,也忘了怎么编了

void  SELL { double Price1_SELL= (Bid-Dist*Point) ; double TP1_SELL=Price1_SELL-TP*Point; double SL1_SELL=Price1_SELL+SL*Point;
   
   double  Price2_SELL= (Price1_SELL -Dist*Point) ;double   TP2_SELL=Price2_SELL-TP*Point;double   SL2_SELL=Price2_SELL+SL*Point;
   
   double  Price3_SELL=(Price2_SELL -Dist*Point) ; double  TP3_SELL=Price3_SELL-TP*Point; double  SL3_SELL=Price3_SELL+SL*Point;
   
   double  Price4_SELL= (Price3_SELL -Dist*Point) ; double  TP4_SELL=Price4_SELL-TP*Point; double  SL4_SELL=Price4_SELL+SL*Point;
   
   double  Price5_SELL= (Price4_SELL -Dist*Point) ;double   TP5_SELL=Price5_SELL-TP*Point; double  SL5_SELL=Price5_SELL+SL*Point;}
 
Dimka-novitsek:

下午好!!!。我的功能是用四十个骂人的词来骂人--显然我不太懂,也忘了怎么编了


迪曼!晚安!你需要休息一下,不是因为职能,而是因为你写的一些废话......

 
所以我说我不记得了。我将完成它。订单。编译器出了什么问题?
 
Dimka-novitsek:
我告诉过你,我不记得了。我把它写进去。订单。编译器不喜欢什么?

F-i's 不是这样写的。阅读课本。

 
谢谢你!!!。阅读。
 
А.钉书针对她来说是不够的!
 

你好,我的专家顾问提出了待定的止损。在测试器中检查时,只有SELL_STOP在工作,而BUY_STOP则出现了订单发送错误/打开买入订单 错误:130

extern int TrailingStop=30;
//-----------------------------------------------------------------------------------------------+
for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELLSTOP &&   // check for opened position 
         OrderSymbol()==Symbol())  // check for symbol
        {
         if(OrderType()==OP_BUY)   // long position is opened
           {
            // check for trailing stop
            if(TrailingStop>0)  
              {                 
               if(Bid-OrderOpenPrice()>Point*TrailingStop)
                  {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
                     return(0);
                    }
              }
           }
         else // go to short position
           {
            // check for trailing stop
            if(TrailingStop>0)  
              {                 
               if((OrderOpenPrice()-Ask)>(Point*TrailingStop))
                    {
                     OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red);
                     return(0);
                    }
              }
           }
        }
     }

   
   return(0);

帮助我找到原因!

 

原因是缺乏逻辑!

for(cnt=0;cnt<total;cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()<=OP_SELLSTOP &&   // check for opened position 
         OrderSymbol()==Symbol())  // check for symbol
        {
         if(OrderType()==OP_BUY)   // long position is opened
           {
如何理解?如果CELLSTOP,BAI与它有什么关系?
 
Twilight:

我如何知道最后的1-2-3订单是否丢失?

而在一般情况下,我怎么知道最后的订单是什么?


最近我写了一个函数,在最后一个输掉的订单的情况下,返回这个订单的类型。换句话说,如果fHistory() == 0,最后一个亏损订单是买入,fHistory() == 1,最后一个亏损订单是卖出。如果我们想追踪盈利的订单,那么就把这一行的符号改成这样:if(OrderProfit() >0)。

//+----------------------------------------------------------------------------+
// Прибыльно или убыточно закрылся последний ордер, и возврат типа такого ордера
int fHistory(){
  for(int i=OrdersHistoryTotal(); i >= 0; i--){              // Выборка в истории
     if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==true){   // Если есть следующий в истории
        if(OrderMagicNumber()!=magN) continue;               // Ордера не нашего эксперта
        if(OrderProfit() < 0 ) return (OrderType());         // Если убыток по посл.ордеру вернем тип ордера
     }
  }
  return(-1);
}

变量magN是全局声明的Magic order。