[存档!]任何菜鸟问题,为了不使论坛变得混乱。专业人士,不要路过。没有你,哪里都不能去 - 4. - 页 268

 
okvseok:

你怎么能理解这些线。

像这样写,然后在日记中寻找。

//---- return orders volume

if(buys>0){
 Print("buys = ",buys);
 return(buys);
}
else{
 Print("-sells = ",-sells);
 return(-sells);// это эквивалентно команде return(sells*(-1));
}
 

你能给我一些建议吗?

我使用几个在全局变量中使用日期的指标

extern bool   shiftdata           = false;
extern string ShiftHistory        = "02.06.2012 00:00";

如果你在历史中改变日期,你必须在所有指标中改变它。

做了一个指标,通过iCustom向int bars发送shift值。

但问题是,它通过了编译后的不变日期(02.07.2012),但当你手动改变它(02.06.2012)时,它却没有通过!这是为什么?

为什么和做什么????

//+------------------------------------------------------------------+
//|                                                        iTime.mq4 |
//|                        Copyright 2012, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 1
extern string BLOK_______1        = "Работа с историей";
extern string ShiftHistory        = "02.07.2012 00:00";
extern string PERIOD              = "D1";
//---
double buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexBuffer(0,buffer);
   SetIndexStyle(0,DRAW_ARROW,0,0);
   SetIndexEmptyValue(0,0.0);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
int  counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
int i,period,limit,bs,barn;

if(PERIOD=="MN1") period=PERIOD_MN1;
else
if(PERIOD=="W1")  period=PERIOD_W1;
else
if(PERIOD=="D1")  period=PERIOD_D1;
else 
if(PERIOD=="H4")  period=PERIOD_H4;
else
if(PERIOD=="H1")  period=PERIOD_H1;
else
if(PERIOD=="M30") period=PERIOD_M30;
else
if(PERIOD=="M15") period=PERIOD_M15;
else
if(PERIOD=="M5")  period=PERIOD_M5;
else
if(PERIOD=="M1")  period=PERIOD_M1;
else
period=PERIOD_D1;

bs=iBarShift(Symbol(),period,StrToTime(ShiftHistory));
barn=iBars(Symbol(),period);
limit=barn-100;

if(limit>bs)
for(i=barn-1; i>=0; i--)
{
if (i==bs) buffer[i]=bs;
} RefreshRates();
return(0);
}

这里是接收器

for(int y=barn-100; y>=0; y--)
{
int bbb,st=iCustom(Symbol(),PERIOD,"iTime",0,y);
if(st>0) bbb=st;
}
 Comment(bbb);

评论写道:"16号班。而在2012年6月2日应该是48。

请帮助提供建议!

 

帮助我确定EA中 "之 "字形的最后高点和低点

双重ZZ1。
int start()
{
zz1=iCustom(NULL,0, "ZigZag", 12, 5, 3, 0, 1)。
MessageBox("zz1="+zz1,"zz1");
return(0);
}
"0.00000 "出来了

 
spek:

帮助我确定EA中 "之 "字形的最后高点和低点

双重ZZ1。
int start()
{
zz1=iCustom(NULL,0, "ZigZag", 12, 5, 3, 0, 1);
MessageBox("zz1="+zz1,"zz1");
return(0);
}
"0.00000 "出来了

double ZZ[10000]={0.0};  //массив для значений ZigZag
double zz1[10000]={0.0};

//-----
int init()
{

}
return(0);
//---
int start()
{
int q=1;   //ПОПРАВИЛ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

for(int i=1; i<=1000; i++)
{
zz1[i]=iCustom(NULL,0,"ZigZag", 12, 5, 3, 0, i);
if(zzl[i]>0) { ZZ[q]=zzl[i];  q++; }
//MessageBox("zz1="+zz1,"zz1");
Comment(ZZ[1],"  ",ZZ[2]);

return(0);
}
 

我想在其中加入 "Alert()",以便在趋势发生逆转时告诉我。

我想把"Alert()"放在那里,告诉我趋势何时逆转。

//+------------------------------------------------------------------+
//|                                                    mikahekin.mq4 |
//|                        Copyright 2004, MetaQuotes Software Corp. |
//|                                                http://www.sasara |
//|                              Modified by: Ronald Verwer/ROVERCOM |
//+------------------------------------------------------------------+
#property copyright "Copyright 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property  indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Silver
#property  indicator_color2  Yellow
#property  indicator_color3  Red
#property  indicator_color4  Blue
#property  indicator_width1 3
#property  indicator_width2 3

//---- input parameters
extern int KPeriod=3;
extern int DPeriod=3;
extern int JPeriod=7;

double ind_buffer1[];
double ind_buffer2[];
double ind_buffer3[];
double ind_buffer4[];
double HighesBuffer[];
double LowesBuffer[];

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
        IndicatorBuffers(6);
   SetIndexStyle(0,DRAW_HISTOGRAM, 0, 3);
   SetIndexStyle(1,DRAW_HISTOGRAM, 0, 3);
   SetIndexStyle(2,DRAW_ARROW, 0, 1);
   SetIndexStyle(3,DRAW_ARROW, 0, 1);
//----
   SetIndexDrawBegin(0,10);
   SetIndexDrawBegin(1,10);
   SetIndexDrawBegin(2,10);
   SetIndexDrawBegin(3,10);
   SetIndexDrawBegin(4,10);
   SetIndexDrawBegin(5,10);
//---- indicator buffers mapping
   SetIndexBuffer(0,ind_buffer1);
   SetIndexBuffer(1,ind_buffer2);
   SetIndexBuffer(2,ind_buffer3);
   SetIndexBuffer(3,ind_buffer4);
   SetIndexBuffer(4, HighesBuffer);
   SetIndexBuffer(5, LowesBuffer);
   
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("mikahekin");
   SetIndexLabel(0,"Open");
   SetIndexLabel(1,"Close");
   SetIndexLabel(2,"High");
   SetIndexLabel(3,"Low");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int start()
  {
   int    i,k,j;
   int    counted_bars=IndicatorCounted();
   double price;
   
//----
   if(Bars<=10) return(0);
//---- initial zero
   if(counted_bars<0) return (-1);
//---- minimums  counting
   i=Bars-KPeriod;
   if(counted_bars>KPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double min=1000000;
      k=i+KPeriod-1;
      while(k>=i)
        {
         price=Low[k];
         if(min>price) min=price;
         k--;
        }
      LowesBuffer[i]=min;
      i--;
     }
//---- maximums counting
   i=Bars-DPeriod;
   if(counted_bars>DPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double max=-100000;
      j=i+DPeriod-1;
      while(j>=i)
        {
         price=High[j];
         if(price>max) max=price;
         j--;
        }
      HighesBuffer[i]=max;
      i--;
     }
//---- mikahekin calcaulation
   i=Bars-JPeriod;
   if(counted_bars>JPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double sumlow=0.0;
      double sumhigh=0.0;
      double sumopen=0.0;
      double sumclose=0.0;
      double close=0.0;
      double open=0.0;
      double high=0.0;
      double low=0.0;

      for(k=(i+JPeriod-1);k>=i;k--)
         {
         sumclose+=Close[k];
         close=sumclose/JPeriod;
         sumlow+= LowesBuffer[k];
         low= sumlow/JPeriod;
         sumopen+=Open[k];
         open=sumopen/JPeriod;
         sumhigh+=HighesBuffer[k];
         high=sumhigh/JPeriod;
         }
         
      ind_buffer1[i]=open;
      ind_buffer2[i]=close;
      ind_buffer3[i]=high;
      ind_buffer4[i]=low;

      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
Z.I. 我在mql4方面比我在芭蕾舞方面好一点,但...
 
Zhunko:

1.我不能添加任何东西。无论你想要什么,都要归还。

2.终端忽略了,你的代码也没有忽略,如果它是这样构建的。系统调用忽略了参数和返回值。这是很明显的。在这种情况下,它回到了哪里?

我们只能猜测这个图案的产生。开发者一定是从默认的INT开始的。


嘀嗒一声来了,终端调用 EA的start()函数。你说这个函数返回的值对终端是无所谓的。这在任何地方都有记载吗?
 
KoKoS:

我想在其中加入 "Alert()",以便在趋势发生逆转时告诉我。

我想用 "Alert() "来告诉我趋势逆转的情况。

Z.U. 我在mql4方面比我在芭蕾舞方面好一点,但...


线路

#property  indicator_color1  Silver
#property  indicator_color2  Yellow

我认为,前两个缓冲区是趋势变化的指标。他们在烛台的顶部有红色的标志,底部有蓝色的标志。只有黄灰色的组合可以作为趋势反转的指标。对他们来说,这将是相应的。

//---- indicator buffers mapping
   SetIndexBuffer(0,ind_buffer1);// для серого цвета
   SetIndexBuffer(1,ind_buffer2);// для жёлтого цвета
在那里,在这些缓冲区的价值中,挖掘。
 
朋友们,请告知通过iCustom转移日期的情况。传递当前的编译值,如何传递在全局层面改变的缓冲区?当我改变日期时,它仍然传递相同的值。
extern bool   shiftdata           = false;
extern string ShiftHistory        = "02.06.2012 00:00";

指标发布在..... 上

或者它没有任何变化?????

你们能不能告诉我通过iCustom进行日期转移的情况?

 

如果你们中的任何一个人可以的话,请帮助编写以下条件的代码。

"如果一个订单在越过移动平均线 后被TakeProfit平仓,那么在价格越过相反方向的移动平均线之前,不要在该方向上再开任何交易"。

提前感谢您的帮助!

 
drknn:

嘀嗒一声来了,终端调用EA的start()函数。你说这个函数返回的值对终端是无所谓的。这在任何地方都有记载吗?
它来自罗马法。这不是被禁止的,所以是被允许的。上面我给出了一个帮助部分的链接。在我们的案例中,听起来是这样的:没有描述任何行为,所以这并不重要。