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

 
Fox_RM:

大家好!

请告知在EA中 iCustom 价值转移的问题是什么。

2014.10.12 10:23:06.656 TestGenerator: unmatched data error (volume limit 470 at 2014.03.14 21:45 exceeded)

2014.10.12 10:23:53.468 2014.03.06 18:15 ClusterExp2 GBPUSD,M15: 2147483647 2147483647

回形针上的Correl8指标。

提前感谢您!

上传你要测试的符号的历史记录。在历史数据中出错,而不是在iCustom()中。
 
artmedia70:
上传被测试角色的历史记录。错误是在历史数据中,而不是在iCustom()中。
谢谢你!!!。
 
borilunad:
早上好,阿尔乔姆!是的,关于魔术师的事情很清楚!我想说的是,我们应该把我们的工作做好。但当某些东西不是在一个循环中,而是在if-else类型的条件中时,只要把第一个条件if(Symbol()==mySymbol)(当然没有else),之前呈现mySymbol=Symbol() 就够了!这样,所有EA的所有变量都是一样的,但每个人都在自己的图形上!我还不能检查,我还在写,"做出来"!:)
如果字符串mySymbol=Symbol();,那么这个变量将包含当前符号的值。因此,对于每个在自己的图表上进行交易的EA,这个变量的值将等于该EA启动时的符号值。
 
artmedia70:
如果字符串mySymbol=Symbol();,那么这个变量将持有当前符号的值。因此,对于每个在自己的图表上进行交易的EA,这个变量的值将等于该EA启动的符号的值。
不知何故,我没有想到这根绳子!"。我还在纠结于在其他EA中运行良好的测试函数中的错误!非常感谢您! 您的建议是什么?
 

打印到一个文件。我正在学习在这个文件上打印。

为什么在cl_time中打印零?

1,37243 1,37253 -1 07:27:13 00:00:00
1,37248 1,37256 -1 07:57:21 00:00:00
1,37256 1,37256 -1 08:17:30 00:00:00
1,37266 1,37268 -1 08:48:11 00:00:00
1,37267 1,37293 -1 08:53:15 00:00:00
1,37269 1,37307 1 09:17:57 00:00:00
1,37275 1,3727 1 10:23:02 00:00:00
1,37269 1,37269 1 10:28:03 00:00:00
1,37268 1,37231 1 10:33:10 00:00:00
1,37278 1,37255 1 10:57:38 00:00:00
1,37256 1,37269 -1 11:02:42 00:00:00
1,37268 1,37284 1 11:07:45 00:00:00
1,37283 1,37307 -1 11:12:49 00:00:00
1,37314 1,37335 1 12:11:37 00:00:00
1,37317 1,37323 1 12:23:12 00:00:00
1,37324 1,37326 1 12:28:20 00:00:00
1,37396 1,37415 1 13:26:32 00:00:00
1,37413 1,37419 1 13:37:20 00:00:00
1,3744 1,37578 1 13:56:29 00:00:00

//+------------------------------------------------------------------+
//|                                                    cci on ma.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+

#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "https://www.mql4.com"
#property strict

input double Lots                   =0.1;

input int Expiration           =5; //laikas minutemis

//---- input parameters
input int cci_p                     = 89;
input int ma                        = 13;
input int NumberOfBarsToCalculate   = 100;

input string   comment=".csv  or  .txt";//коментарий
input string   FileType="csv";//тип файла 

datetime op_time=0,cl_time=0;
double  op_price=0,cl_price=0;
int op_type=0;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick(void)
  {
   
   int    cnt,ticket,total;

   

//---
   if(Bars<cci_p+1)
     {
      Print("bars less than ",cci_p);
      return;
     }

//--- to simplify the coding and speed up access data are put into internal variables
   double cci_dn=iCustom(NULL,0,"cci_ma",cci_p,ma,NumberOfBarsToCalculate,2,0);
   double cci_up=iCustom(NULL,0,"cci_ma",cci_p,ma,NumberOfBarsToCalculate,3,0);
   

   total=OrdersTotal();
   if(total<1)
     {
      //--- check for long position (BUY) possibility
      if(cci_up>0 && cci_up!=EMPTY_VALUE)
        {
         ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,0,"cci sample",16384,0,Green);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
               
               op_time=TimeLocal();
               op_price=Close[0];
               op_type=1;
               Print("BUY order opened : ",OrderOpenPrice());
               Print("op_price : ",op_price, "op_time : ",op_time);
           }
         else
            Print("Error opening BUY order : ",GetLastError());
         return;
        }
      //--- check for short position (SELL) possibility
      if(cci_dn<0 && cci_dn!=EMPTY_VALUE)
        {
         ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,"cci sample",16384,0,Red);
         if(ticket>0)
           {
            if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES))
               
               op_time=TimeLocal();
               op_price=Close[0];
               op_type=-1;
               Print("BUY order opened : ",OrderOpenPrice());
               Print("op_price : ",op_price, "op_time : ",op_time);
           }
         else
            Print("Error opening SELL order : ",GetLastError());
        }
      //--- exit from the "no opened orders" block
      return;
     }
//--- it is important to enter the market correctly, but it is more important to exit it correctly...   
   for(cnt=0;cnt<total;cnt++)
     {
      if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
         continue;
      if(OrderType()<=OP_SELL &&   // check for opened position 
         OrderSymbol()==Symbol())  // check for symbol
        {
         //--- long position is opened
         if(OrderType()==OP_BUY)
           {
            //--- should it be closed?
            if(TimeCurrent()>=op_time+Expiration*60)
              {
               //--- close order and exit
               if(!OrderClose(OrderTicket(),OrderLots(),Bid,3,Violet))
               
               cl_time=TimeCurrent();//op_time+Expiration*60;
               cl_price=Close[0];               
               
               Print("OrderClose error ",GetLastError());               
               
              PrintToFile(op_price, cl_price, op_type, op_time, cl_time);
      
               return;
              }  
           }
         else // go to short position
           {
            //--- should it be closed?
            if(TimeCurrent()>=op_time+Expiration*60)
              {
               //--- close order and exit
               if(!OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet))
               cl_time=TimeCurrent();//op_time+Expiration*60;
               cl_price=Close[0];              
               
               Print("OrderClose error ",GetLastError());               
               
               PrintToFile(op_price, cl_price, op_type, op_time, cl_time);
                  
               return;
              }         
           }
        }
     }
//---
  }
//+------------------------------------------------------------------+
void PrintToFile(double opPrice=0,double clPrice=0,int opType=0, datetime opTime=0, datetime clTime=0)
{
   string fileName=StringConcatenate(Symbol()," ",Period()," ","gi_EA_cci");
   
   int handle;
   handle=FileOpen(fileName+FileType, FILE_WRITE|FILE_READ,";");
               if(handle!=INVALID_HANDLE)
               {
                  PrintFormat("Файл %s открыт для записи",fileName);
                  PrintFormat("Путь к файлу: %s\\Files\\",TerminalInfoString(TERMINAL_DATA_PATH));
                  //--- сначала запишем количество сигналов
                  FileSeek(handle, 0, SEEK_END);
                  FileWrite(handle,
                           opPrice,
                           clPrice,
                           opType,                           
                           TimeToString(opTime,TIME_MINUTES|TIME_SECONDS), 
                           TimeToString(clTime,TIME_MINUTES|TIME_SECONDS));
      
      
                  //--- закрываем файл
                  FileClose(handle);
                  PrintFormat("Данные записаны, файл %s закрыт",fileName);
               }
               else
               PrintFormat("Не удалось открыть файл %s, Код ошибки = %d",fileName,GetLastError());
}
 
你能告诉我,如何识别董事会上的提款吗?
 
beginner:
你能告诉我如何在董事会上定义提款吗?

对于一些 "订单",OrderType()产生一个数值等于6的值。这些是提款和存款。

在成功调用OrderSelect() 后(返回true),你可以通过OrderProfit()返回的值来确定提款/充值的大小,并通过这个值的符号--是提款还是存款...

另外,有些经纪商收取佣金,按佣金的数额模仿提款。你可以尝试通过使用OrderComment()获得的注释来区分收取佣金和从账户中提款。

然而,要小心:这都是没有记录的,可能随时停止工作。

 
simpleton:


谢谢你!
 
亲爱的程序员!在优化专家顾问 时,我个人认为,与其他许多参与者一样,试图找到利润与最大缩水的最大比率(比率:利润/损失),我认为这是最重要的指标。我在完成测试器的运行后手动进行这一程序。是否有可能使这一过程自动化?或者说,你们每个人是如何确定这个参数的?预先感谢你。
 
yosuf:
亲爱的程序员!在优化专家顾问时,我个人认为,与其他许多参与者一样,试图找到利润与最大缩水的最大比率(比率:利润/损失),我认为这是最重要的指标。我在完成测试器的运行后手动进行这一程序。是否有可能使这一过程自动化?或者说,你们每个人是如何确定这个参数的?预先感谢你。

我是这样做的

//+---------------------- OnTester() --------------------------------+
double OnTester()
{
double Result     = 0;
double Profit     = TesterStatistics(STAT_PROFIT);
double Drowdown   = TesterStatistics(STAT_EQUITY_DD);

if(Drowdown>0)
Result = Profit/Drowdown;
else Result = 0;

   return(NormalizeDouble(Result,2));
}
//+------------------------------------------------------------------+