任何菜鸟问题,为了不给论坛添乱。专业人士,不要路过。没有你就无处可去 - 6. - 页 184

 
Roger:
在这一分钟内,专家顾问将打开多达四十个订单。

如果第一件事打不开呢?等待下一个信号的时间是一个小时?它是可以的。

有一个信号 --> 检查这个蜡烛图上是否有订单/仓位设置/开仓,没有 --> 设置/开仓,有 --> 则不需要再做。

 
Sepulca:

这就是控制......订单数量或只是对函数的第一次调用的方法......。


因此,像你这样的线路不止一条。
 
感谢大家的帮助。该功能正在发挥作用。结果已收到。
 
extern int SecondsAfterTheBar = 0; 

int start(){
...
if(NewBar() == TRUE){
...
}
return(0);
}

bool NewBar(){
   RefreshRates();
   static bool initial = FALSE;
   static datetime stat_dtime = 0;
   if ((TimeCurrent() - stat_dtime >= Time[0] - Time[1] + SecondsAfterTheBar) == TRUE){
      stat_dtime = Time[0];
    if (initial == TRUE){
      return(TRUE);
    }else{
      initial = TRUE;
      }
   }
  return(FALSE);
}

我可能太晚了,但无论如何任何人都可以使用我的解决方案。

 
digits:

显然我迟到了,但无论如何我的解决方案可能对某人有用。


谢谢你。更加普遍的是,如果

bool NewBar( datetime SecondsAfterTheBar = 0 )

然后你可以在调用它时指定滞后的时间,单位是秒。

 


朋友们好。请告诉我如何从上一个蜡烛图中获得指标颜色值,并将其写入一个变量中,例如,如果是红色,那么双col =1,如果是黄色,那么2,如果是绿色,那么3。我尝试了不同的变体,但没有成功。我知道颜色的值取决于缓冲区内的单位的可用性,但由于某些原因,我不能准确地得到最后的固定值,即活跃的蜡烛,它不断地随着新的前一个蜡烛的出现而改变颜色,关闭最后的作用颜色。我怎么知道呢?)

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 1

#property  indicator_buffers 3
#property  indicator_color1  DarkGreen
#property  indicator_color2  Crimson
#property  indicator_color3  Yellow
//---- indicator parameters      
extern int RSI=8;
extern int valeur1=55;
extern int valeur2=45;

//---- indicator buffers
double   ExtBuffer1[];
double   ExtBuffer2[];
double   ExtBuffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle (0,DRAW_HISTOGRAM, EMPTY,4,DarkGreen);
   SetIndexBuffer(0,ExtBuffer1);
   SetIndexStyle (1,DRAW_HISTOGRAM, EMPTY,4,Crimson);
   SetIndexBuffer(1,ExtBuffer2);
   SetIndexStyle (2,DRAW_HISTOGRAM, EMPTY,4,Yellow);
   SetIndexBuffer(2,ExtBuffer3);
//---- names
   IndicatorShortName("RSI above/under 45/55");
   SetIndexLabel(0,"RSI"+RSI +" is above 55");
   SetIndexLabel(1,"RSI"+RSI +" is under 45");
   SetIndexLabel(2,"RSI is in the mid zone ");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Moving Averages                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1st buffer
   for(int i=0; i<limit; i++)
       if (iRSI(NULL,0,RSI,PRICE_CLOSE,i)<=valeur2) 
        {
        ExtBuffer2[i]=1;
        }
       else
       if (iRSI(NULL,0,RSI,PRICE_CLOSE,i)>=valeur1)
        {
        ExtBuffer1[i]=1;
        }
       else 
        ExtBuffer3[i]=1;
   
   return(0);
  }

这个颜色。

指标

谢谢你的答复。

 
Kero:


朋友们好。请告诉我如何从上一个蜡烛图中获得指标颜色值,并将其写入一个变量中,例如,如果是红色,那么双col =1,如果是黄色,那么2,如果是绿色,那么3。 我尝试了不同的变体,但没有成功。我知道颜色的值取决于缓冲区内的单位的可用性,但由于某些原因,我不能准确地得到最后的固定值,即活跃的蜡烛,它不断地随着新的前一个蜡烛的出现而改变颜色,关闭最后的作用颜色。我怎么知道呢?)

int col;
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- macd counted in the 1st buffer
   for(int i=0; i<limit; i++)
       if (iRSI(NULL,0,RSI,PRICE_CLOSE,i)<=valeur2) 
        {
        ExtBuffer2[i]=1;if(i=1)col =1;return;
        }
       else
       if (iRSI(NULL,0,RSI,PRICE_CLOSE,i)>=valeur1)
        {
        ExtBuffer1[i]=1;if(i=1)col =3;return;
        }
       else 
       {
        ExtBuffer3[i]=1;
        if(i=1)col =2;
       }
   return(0);
  }
像这样--如果带有数字的颜色没有被混淆的话
 

这是开订单的条件吗?我的理解是否正确?

 
KeinRich:

这是开订单的条件吗?我的理解是否正确?


这个条件是为了满足你的一切需要,因为我们只能通过名字来猜测这些自定义函数的作用
order_total(0)
open(0,Lot,0,TP);
last_trade(1);
modify_orders(1);

 
KeinRich:

大家好...你们能告诉我这是什么意思吗?

int start()
...

return(0);

一切纯属我的猜测,而且只是推测。

int start() {
   Comment(Info());                 // Вывод какой-то информации на экран
   int KOL_BUY  = order_total(0);   // Подсчёт количества Buy-позиций
   int KOL_SELL = order_total(1);   // Подсчёт количества Sell-позиций
   double l;                              

   if (order_total()==0) {          // Если количество ордеров равно нулю
      open(0,Lot,0,TP);             // Открываем Buy лотом Lot скорее всего без стопа, но с тейком
      open(1,Lot,0,TP);             // Открываем Sell лотом Lot скорее всего без стопа, но с тейком
      }
   if (KOL_BUY==0 && KOL_SELL!=0) { // Если нет Buy и есть Sell
      open(0,Lot,0,TP);             // Открываем Buy лотом Lot скорее всего без стопа, но с тейком
      l=last_trade(1);              // Берём лот прошлой Sell
      open(1,l,0,0);                // Открываем Sell лотом прошлой Sell скорее всего без стопа и тейка
      modify_orders(1);             // Что-то модифицируем в Sell (в какой и что - не понятно)
      }
   if (KOL_BUY!=0 && KOL_SELL==0) { // Если нет Sell и есть Buy
      open(1,Lot,0,TP);             // Открываем Sell лотом Lot скорее всего без стопа, но с тейком
      l=last_trade(0);              // Берём лот прошлой Buy
      open(0,l,0,0);                // Открываем Buy лотом прошлой Buy скорее всего без стопа и тейка
      modify_orders(0);             // Что-то модифицируем в Buy (в какой и что - не понятно)
      }
   return(0);                       // Выход из start()
}