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

 

伙计们,请帮忙。我想写一个函数,使每个下一个开仓的订单的手数比前一个大2倍。这个函数给出了错误的值...它有什么问题呢?提前感谢!



extern double LotBuy = 0.01;


double GetLotBuy()

{

for(int n = 1; n<=CountBuy(); n++)
{
LotBuy=LotBuy*2;
}
return (LotBuy);
}

 
Trader7777:

伙计们,请帮忙。我想写一个函数,使每个下一个开仓的订单的手数比前一个大2倍。这个函数给出了错误的值...它有什么问题呢?提前感谢!



extern double LotBuy = 0.01;


double GetLotBuy()

{

for(int n = 1; n<=CountBuy(); n++)
{
LotBuy=LotBuy*2;
}
return (LotBuy);
}


对于初学者来说。

extern double LotBuy = 0.01;

double GetLotBuy()

{
double ld_Lot = LotBuy;
for(int n = 1; n<=CountBuy(); n++)
{ld_Lot = LotBuy * n * 2;}
return (ld_Lot);
}

 
Trader7777:

伙计们,请帮忙。我想写一个函数,使每个下一个开仓的订单以2倍于前一个的手数开仓。这个函数给出了错误的值...它有什么问题呢?提前感谢!



extern double LotBuy = 0.01;


double GetLotBuy()

{

for(int n = 1; n<=CountBuy(); n++)
{
LotBuy=LotBuy*2;
}
return (LotBuy);
}

试试这个。

double OrderLotsSB(string sy="", int op=-1, int mn=-1) { 
 datetime o;
   int      i, k=OrdersTotal(); double r=-1;

  if (sy=="0") sy=Symbol();
  for (i=0; i<k; i++) {
    if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
      if (OrderSymbol()==sy || sy=="") {
        if ( OrderType()==OP_SELL||OrderType()==OP_BUY) {
          if (op<0 || OrderType()==OP_SELL||OrderType()==OP_BUY) {
            if (mn<0 || OrderMagicNumber()==Magic) {
              r=OrderLots()*2;
            }
          }
        }
      }
    }
  }
  return(r);
}
 
TarasBY:

对于一个开始。

extern double LotBuy = 0.01;

double GetLotBuy()

{
double ld_Lot = LotBuy;
for(int n = 1; n<=CountBuy(); n++)
{ld_Lot = LotBuy * n * 2;}
return (ld_Lot);
}



你在跟我开玩笑吗?
 

在我自己的指标基础上做了一个EA。

开盘交易在指标相对于昨天的上升时买入,在指标的下降时卖出。

问题是,交易通过一个或更多的条形图打开和关闭。

该指标被设定为忽略在某一设定值上的移动。

如果没有多余的,指标值仍与前一栏相同(我认为问题出在这里)。

指标代码。

//+------------------------------------------------------------------+
//|                                                         EMAF.mq4 |
//|                                                 Kamil Gazizullin |
//|                                             forexman77@yandex.ru |
//+------------------------------------------------------------------+
#property copyright "Kamil Gazizullin"
#property link      "forexman77@yandex.ru"
#property indicator_chart_window
#property indicator_buffers 1
#property  indicator_color1 Red
//--- input parameters
//--- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,0,1);
   SetIndexBuffer(0,ExtMapBuffer1);
   IndicatorDigits(Digits+1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
    int counted_bars=IndicatorCounted(),                      
    limit;
    double
    raznica,raznica_static,
    MA_1_t,                                                  
    MA_2_t;
 
   if(counted_bars>0)
      counted_bars--;
   limit=Bars-counted_bars;
   for(int i=0;i<limit;i++)
   {  
      static double MA_otshet;
      MA_1_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+0);  
      MA_2_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+1); 
      raznica=MA_1_t-MA_2_t;
      raznica_static=MA_1_t-MA_otshet;
      if(raznica_static > -0.003 && raznica_static < 0.003)
      {
      ExtMapBuffer1[i]=MA_otshet;
      }
      else
      if(raznica > -0.003 && raznica < 0.003)
      {
      ExtMapBuffer1[i]=MA_2_t;
      MA_otshet=MA_2_t;
      }
      if((raznica > 0.003) || (raznica <- 0.003))
      {
      ExtMapBuffer1[i]=MA_1_t;
      }
   }
   return(0);
  }
//+------------------------------------------------------------------+

EA的交易标准。

   // Торговые критерии
EMAF_1=iCustom(NULL, 0, "EMAF",0,0,i+0);    
EMAF_2=iCustom(NULL, 0, "EMAF",0,0,i+1); 
static datetime t;
if  (EMAF_1 > EMAF_2)
          {                                          
          Opn_B=true; 
          t=Time[0];                  
          }
if  (EMAF_1 < EMAF_2)
      {
       if(Time[0]>t)
          {                                      
          Cls_B=true;              
          }
      }
 
klop:
你好!

需要一个这样的脚本。


欧元/英镑/1手/开盘312.25/下滑559.45/最高价454.55
yui/ghf / 1 lot / open 3.28 / sl 5.65 / tp 4.65
.../... / 1手 / 打开 ...... / sl ...... / tp .......


成为
欧元/英镑/1.02手/开盘312.25/最低价559.45/最高价454.55
yui/ghf / 1.02 lot / open 3.28 / sl 5.65 / tp 4.65
.../... / 1.02 lot / open ...... / sl ...... / tp .......

什么会关闭具有一定数量(手)的挂单,并以另一种数量开立新的订单,但同样的进入水平、停止和采取。

我不知道......也许有人做过。
如果你正在寻找一个具有这种功能的脚本,你可以使用本网站的搜索引擎。
 
max020780:



我不明白这里的一切......


我希望如果第二个单向订单被打开,手数以几何级数 增加(乘数为2)。

 
Vinin:

你是在开玩笑吗?
解决办法往往由几个 "步骤 "组成。第1步是减少地段面积的指数 增长。一路走来,我们至少给循环的使用赋予了一些意义。既然我们不知道 "起点在哪里",进一步的步骤就留给作者。;)
 
TarasBY:
解决办法往往由几个 "步骤 "组成。第1步是减少地段面积的指数增长。同时,我们至少要给循环的使用赋予一些意义。既然我们不知道 "起点在哪里",那么进一步的步骤就取决于作者了。;)

这当然很好,但仍旧是,如何表达如何打开下一个比前一个多出一倍的单向订单?已经有两个工作函数CountBuy()和CountSell()。
 
Trader7777:
是什么阻止了你做这样的检查(脚本)?
附加的文件: