我怎样才能获得订单打开后的最高价。 - 页 6

 

我解决了第一个问题(我犯了错误谢谢diostar

//我应该把 if(OrdersTotal()>0){
if (((lastOpenedOpenPriceBuy()-0.0030)>MarketInfo("EURUSD",MODE_BID)) )
{ SELL("EURUSD",S_EURUSD_LS_1,S_EURUSD_TP_1,S_EURUSD_SL_1,S_EURUSD_TS_1, "if ( ( (lastOpenedOpenPriceBuy()-0.0030>MarketInfo(EURUSD,MODE_BID) ) ) " );} } 对于第二种情况,如果( ((lastOpenedOpenPriceBuy()-0.0030)>MarketInfo("EURUSD",MODE_BID)) )

}


对于第二个:

if ( ( ((lastOpenedOpenPriceBuy()-lastOpenedOpenPriceSell() )>=0.0060) &&( lastClosedClosePrice()<beforelastCloseClosePrice()) )
{ closeshort("eurusd") ;}

我不知道我应该怎么做:

供你参考的CLOSESHORT函数 是:

int CLOSESHORT(string symbol_c) {
CloseAllPositions(symbol_c,OP_SELL,MagicNumberShort);
CloseAllPositions(symbol_c,OP_SELL,MagicNumberShort);
return(0);
}


谢谢

 

我现在很迷惑。

你是在回答第一个函数 lastOpenedOpenPriceBuy() 的问题吗?

我现在可能只能处理这个问题了。那么,你到底要做什么修复。现在的代码是什么样的?

 
diostar:

我现在很困惑。

你不是唯一的人......不要再浪费时间了。
 
RaptorUK:
你不是唯一的一个......不要再浪费时间了。

你知道吗,这个主题可能是最长的一个。 而在6页之后,我感到困惑。 不,我仍然说这不是 "浪费"。

(这只是意味着它是新方向、新生活、新开始的时候。 对每个人来说)。

 
我在这个问题上也花了不少时间,我添加了代码 并提出了建议.......当你把马拉到水边,用干草调味,并添加一些苹果,但马仍然不想喝水时,就应该意识到马不想喝水......它想通过静脉滴注来获取水......在这一点上,就我而言,马是靠自己的。
 
RaptorUK:
我也在这个问题上花了不少时间,我添加了代码并提出了建议.......当你把马拉到水边,用干草调味,再加上一些苹果,但马还是不想喝水的时候,就应该意识到马不想喝水了......它想通过静脉滴注来摄入水......在这一点上,我认为马是靠自己的。

我明白了。最终的回报可能不是 "注定 "的,因为马得到了滋养,那么对那些努力的人的回报就一定是别的东西。

这要感谢那匹马。

 

谢谢diostar 的帮助。

现在我有85%的错误被纠正了,让我们看看。

1- 我们创建了4个函数(请在本页末尾看到它们)

*lastOpenedOpenPriceBuy()

* lastOpenedOpenPriceSell()

*lastClosedClosePrice()
*beforelastClosedClosePrice()

2- 我们在使用时遇到了第一个问题。

if (  ((lastOpenedOpenPriceBuy()-0.0030)>MarketInfo("EURUSD",MODE_BID))  ) 
   {  SELL("EURUSD",S_EURUSD_LS_1,S_EURUSD_TP_1,S_EURUSD_SL_1,S_EURUSD_TS_1,"if (  ( (lastOpenedOpenPriceBuy()-0.0030)>MarketInfo(EURUSD,MODE_BID) )  )") ;}
  if (  ((lastOpenedOpenPriceSell()+0.0030)<MarketInfo("EURUSD",MODE_BID))  ) 
   {  BUY("EURUSD",B_EURUSD_LS_1,B_EURUSD_TP_1,B_EURUSD_SL_1,B_EURUSD_TS_1,"if (  ( (lastOpenedOpenPriceSell()+0.0030)<MarketInfo(EURUSD,MODE_BID) )  )") ;}

我们通过添加.Ctrl+C来纠正它。

if(OrdersTotal()>0){
  if (  ((lastOpenedOpenPriceBuy()-0.0030)>MarketInfo("EURUSD",MODE_BID))  ) 
   {  SELL("EURUSD",S_EURUSD_LS_1,S_EURUSD_TP_1,S_EURUSD_SL_1,S_EURUSD_TS_1,"if (  ( (lastOpenedOpenPriceBuy()-0.0030)>MarketInfo(EURUSD,MODE_BID) )  )") ;}
  if (  ((lastOpenedOpenPriceSell()+0.0030)<MarketInfo("EURUSD",MODE_BID))  ) 
   {  BUY("EURUSD",B_EURUSD_LS_1,B_EURUSD_TP_1,B_EURUSD_SL_1,B_EURUSD_TS_1,"if (  ( (lastOpenedOpenPriceSell()+0.0030)<MarketInfo(EURUSD,MODE_BID) )  )") ;}
  }

3- 第二个问题是。

if ( ((lastOpenedOpenPriceBuy()-lastOpenedOpenPriceSell())>=0.0060)&&(((lastOpenedOpenPriceBuy()+lastOpenedOpenPriceSell())/2)<MarketInfo("EURUSD",MODE_BID))
         &&(lastClosedClosePrice()< beforelastClosedClosePrice()) )  
   {  CLOSESHORT("EURUSD") ;}

如果我删除&&(lastClosedClosePrice()< beforelastClosedClosePrice()).那么一切都会好 起来。

没有问题。

*((lastOpenOpenPriceBuy()-lastOpenOpenPriceSell())>=0.0060)

*(((lastOpenOpenPriceBuy()+lastOpenOpenPriceSell())/2)<MarketInfo("EURUSD",MODE_BID))

唯一的问题是&&(lastClosedClosePrice()< beforelastClosedClosePrice() )

举个例子。

如果5号订单开盘是卖出,然后6号订单开盘并关闭,该订单是买入,然后7号订单开盘并买入。

这种情况将是(lastClosedClosePrice()< beforelastClosedClosePrice()

( 订单号6 < 订单号4 ) // 因为订单号5仍然没有关闭。

我应该怎么做?我不知道。我 试图用if(OrdersHistoryTotal()>0){then insert all the conditions but no way }

double lastOpenedOpenPriceBuy()
  {
   double ret = 0;
   datetime time=0;
   for(int i=0; i<OrdersTotal(); i++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()==OP_BUY && OrderOpenTime()>time) {
         time = OrderOpenTime();
         ret = OrderOpenPrice();
      }
   }
   
   return(ret);
  }


double lastOpenedOpenPriceSell()
  {
   double ret = 0;
   datetime time=0;
   for(int i=0; i<OrdersTotal(); i++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()==OP_SELL && OrderOpenTime()>time) {
         time = OrderOpenTime();
         ret = OrderOpenPrice();
      }
   }
   
   return(ret);
  }



double lastClosedClosePrice()
  {
   double ret = 0;
   datetime time = 0;
   for(int i=OrdersHistoryTotal()-1; i>=0; i--) {
      OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
      if(OrderType()<2 && OrderCloseTime()>time) {
         time = OrderCloseTime();
         ret = OrderClosePrice();
      }
   }
   
   return(ret);
  }


double beforelastClosedClosePrice()
  {
   double ret = 0;
   double ret2 = 0;
   datetime time = 0;
   for(int i=OrdersHistoryTotal()-1; i>=0; i--) {
      OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
      if(OrderType()<2 && OrderCloseTime()>time) {
         time = OrderCloseTime();
         ret = ret2;
         ret2 = OrderClosePrice();
      }
   }
   if(ret==0) {
      ret = ret2;
   }
   
   return(ret);
  }
 
double lastOpenedOpenPriceBuy()
  {
   double ret = 0;
   datetime time=0;
   for(int i=0; i<OrdersTotal(); i++) {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      if(OrderType()==OP_BUY && OrderOpenTime()>time) {
         time = OrderOpenTime();
         ret = OrderOpenPrice();
      }
   }
   
   return(ret);
  }

不是 我建议的,而且 "我们 "没有创造这个。这100%是你的。