どんな新人の質問でも、フォーラムを乱雑にしないように。プロフェッショナルは、通り過ぎないでください。Nowhere without you - 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のすべての変数が同じで、それぞれが独自のグラフになるようにしますまだ確認できません!「作りかけ」で書いています。:)
string mySymbol=Symbol(); とすれば、この変数には現在のシンボルの値が格納される。したがって、独自のチャートで取引する各EAについて、この変数の値は、EAが起動されたシンボルの値に等しくなります。
 
artmedia70:
string 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:


ありがとうございました。
 
プログラマーの皆様へExpert Advisor を最適化 する際、私自身は、他の多くの参加者と同様に、最大ドローダウンに対する最大利益の比率(比率:利益/損失)を見つけるようにしており、これは最も重要な指標だと考えています。この手続きは、テスターの実行が完了した後に手動で行っています。この処理を自動化することは可能でしょうか?あるいは、このパラメーターは各自がどのように決めているのでしょうか。よろしくお願いします。
 
yosuf:
プログラマーの皆様へExpert Advisor を最適化する際、私自身は、他の多くの参加者と同様に、最大ドローダウンに対する最大利益の比率(比率:利益/損失)を見つけるようにしており、これは最も重要な指標だと考えています。この手続きは、テスターの実行が完了した後に手動で行っています。この処理を自動化することは可能でしょうか?あるいは、このパラメーターは各自がどのように決めているのでしょうか。よろしくお願いします。

そうです

//+---------------------- 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));
}
//+------------------------------------------------------------------+