찻주전자의 질문 - 페이지 253

 
lucky_teapot :

여러분, 제 테스터가 테스트할 때 프로세서의 4개 코어 중 하나의 절반만 사용하는 이유는 무엇입니까?


프로세서의 1/8만 완전히 로드된 상태에서 테스트할 때 이것은 윙윙거리지 않습니다.

엄청나게 느리다...

고맙습니다.

시각화가 포함된 테스트에 대해 이야기하고 있다면 이것은 일종의 정상입니다.

단일 실행에 대한 경우 1 실행에 1 프로세서가 사용됩니다.

많은 패스를 사용하여 전략을 테스트하는 것에 대해 이야기하고 있다면 여기에서 프로세서의 스크린샷 1개를 얻을 수 없습니다. 테스트하는 동안 최소한 스크린샷을 찍어야 합니다.

 

이 포럼의 기사에 따라 처음으로 지표를 MQL4에서 MQL5로 변환하려고 시도했지만 완료할 수 없습니다.

나는 최근의 실수를 극복할 수 없다.

https://www.mql5.com/en/articles/66

그 외 부족한 점을 알려주세요

 //+------------------------------------------------------------------+
//|                                                           FT.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link        "http://www.mql5.com"
#property version    "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots    1
//--- plot Fisher
#property indicator_label1   "Fisher"
#property indicator_type1   DRAW_LINE
#property indicator_color1   clrRed
#property indicator_style1   STYLE_SOLID
#property indicator_width1   1

#include <mql4_2_mql5.mqh>
//--- input parameters
input    ENUM_APPLIED_PRICE Mode = PRICE_CLOSE ;
input int       StochPeriod= 21 ;
int StochMode = 0 ;
int SmoothType1 = 3 ;
int SmoothPeriod1 = 4 ;
double K = 1 ;
int SmoothType2 = 3 ;
int SmoothPeriod2 = 4 ;
int Buffers = 0 ;
int DrawBegin = 0 ;


//--- indicator buffers
double FisherBuffer[];
double Stoch[];
double Value1[];
double F[];

//int init() 
//{
//   if (StochPeriod < 3) 
 //     StochPeriod = 3;
//   drawBegin = StochPeriod;      
   // initBuffer(Fisher, "Fisher", DRAW_LINE);
   // initBuffer(Value1);
   //initBuffer(stoch);
   // initBuffer(f);
   // IndicatorBuffers(buffers);
   // string name = "FT("+PriceMode+","+StochPeriod+","+StochMode+","
   //    +SmoothType1+","+SmoothPeriod1+","
   //    +DoubleToStr(k,2)+","+SmoothType2+","+SmoothPeriod2+")";
   //IndicatorShortName(name);
   // SetIndexLabel(0,name);
 //  return (0);
//}

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,FisherBuffer, INDICATOR_DATA );
SetIndexBuffer ( 1 ,Value1, INDICATOR_DATA );
SetIndexBuffer ( 2 ,Stoch, INDICATOR_DATA );
SetIndexBuffer ( 3 ,F, INDICATOR_DATA );
   
    
InitMql4();

   ArraySetAsSeries (FisherBuffer, true );
ArraySetAsSeries (Value1, true );
ArraySetAsSeries (Stoch, true );
ArraySetAsSeries (F, true );
   
//---
   return ( 0 );
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate ( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[])
  {
   int bars=MQL4Run(rates_total,prev_calculated);
//---
  start(bars,
      CountedMQL4,
      FisherBuffer,
      Stoch,
      Value1,
      F,
      Mode,
      StochPeriod,
      StochMode,
      SmoothType1,
      SmoothPeriod1,
      K,
      SmoothType2,
      SmoothPeriod2,
      Buffers,
      DrawBegin); 
//--- return value of prev_calculated for next call

   return (rates_total);
   }
   //+--------------------+------------------+
//|              MQL4  | MQL5             |
//+--------------------+------------------+
//|IndicatorCounted()  | prev_calculated  |
//|              Bars  | rates_total      |
//|              iMA(  | iMAMql4(         |
//|       iMAOnArray(  | iMAOnArrayMql4(  |
//+--------------------+------------------+ 
       int start( int rates_total,
         int prev_calculated, 
         double &fisher[],
         double &stoch[],
         double &value1[],
         double &f[],
         int mode,
         int stochPeriod,
         int stochMode,
         int smoothType1,
         int smoothPeriod1,
         double k,
         int smoothType2,
         int smoothPeriod2,
         int buffers,
         int drawBegin)


{
   if (rates_total <= stochPeriod)  
       return ( 0 );
   int countedBars = prev_calculated;
   if (countedBars < 0 ) 
       return (- 1 );
   if (countedBars > 0 ) 
      countedBars--;
   int s, limit = rates_total - countedBars - 1 ;
   for (s = limit; s >= 0 ; s--) 
   {
       double price = P(s);
       double MaxH = price;
       double MinL = price;
       for ( int i = 0 ; i < stochPeriod; i++) 
      {
         if (stochMode == 0 )
         {
         price = P(s + i);
         if (price > MaxH) 
            MaxH = price;
         if (price < MinL) 
            MinL = price;
         }
         else
         {
            MaxH = MathMax (MaxH,High[s+i]);
            MinL = MathMin (MinL,Low[s+i]);
         }
      }
      stoch[s] = 2.0 * ((P(s) - MinL) / (MaxH - MinL) - 0.5 );
   }
  smooth(stoch,value1,smoothType1,smoothPeriod1,limit);
   for (s = limit; s >= 0 ; s--)
   {
      f[s] = MathLog (( 1.0 + val(Value1[s])) / ( 1.0 - val(Value1[s]))) / 2.0 ;
   }    
   smooth(f,fisher,smoothType2,smoothPeriod2,limit);
   return ( 0 );
}

double P( int index) 
{
   return (iMAMql4( NULL , 0 , 1 , 0 , MODE_SMA ,Mode,index));
}

//void initBuffer(double &array[], string label = "", 
 //  int type = DRAW_NONE, int arrow = 0, int style = EMPTY, 
 //  int width = EMPTY, color clr = CLR_NONE) 
//   SetIndexBuffer(buffers, array);
 //  SetIndexLabel(buffers, label);
//   SetIndexEmptyValue(buffers, EMPTY_VALUE);
//   SetIndexDrawBegin(buffers, drawBegin);
//   SetIndexShift(buffers, 0);
//   SetIndexStyle(buffers, type, style, width);
//  SetIndexArrow(buffers, arrow);
 //  buffers++;
//}

double val( double v)
{
   return ( MathMax ( MathMin (K * v, 0.999 ),- 0.999 ));
}


void smooth( int rates_total, double &inp[], double &out[], int type, int len, int limit)
{
   switch (type)
   {
       case 0 :
         HTMA(rates_total-StochPeriod,len,inp,out);
         break ;
       case 1 :
         // HMA(len,inp,out);
         break ;
       case 2 :
         // LWMA(len,inp,out);
         break ;
       case 3 :
         // EMA(len,inp,out);
         break ;
   }
}

void HTMA( int N, int HMALen, double &onput[], double &output[])
{
   double ma1,ma2,hma,mix,mixprime;
   ma1=onput[N- 1 ];
   ma2=ma1;
   mix= 3.0 /( 2.0 + HMALen);
   mixprime= 1.0 -mix;
   for ( int i=N- 2 ;i>= 0 ;i--)
   {
      ma1=mixprime*ma1 + mix*onput[i];
      ma2=mixprime*ma2 + mix*ma1;
      output[i]= 3.0 *ma1- 2.0 *ma2;
   }
}

void HMA( int rates_total, int per, double &array[], double &out[])
{
   double tmp[];
   ArrayResize (tmp,rates_total);
   ArraySetAsSeries (tmp, true );
   for ( int i = rates_total- 1 ; i >= 0 ; i--)
   {
      tmp[i] =
         2 *iMAOnArrayMql4(array, 0 ,per/ 2 , 0 , MODE_LWMA ,i)
         -iMAOnArrayMql4(array, 0 ,per, 0 , MODE_LWMA ,i);
   }
   for ( int i = rates_total- 1 ; i >= 0 ; i--)
   {
      out[i] = iMAOnArrayMql4(tmp, 0 , MathSqrt (per), 0 , MODE_LWMA ,i);
   }
}

void LWMA( int rates_total, int len, double &inp[], double &out[])
{
   for ( int i = rates_total- 1 ; i >= 0 ; i--)
   {
      out[i] = iMAOnArrayMql4(inp, 0 ,len, 0 , MODE_LWMA ,i);
   }
}

void EMA( int rates_total, int len, double &inp[], double &out[])
{
   for ( int i =rates_total - 1 ; i >= 0 ; i--)
   {
      out[i] = iMAOnArrayMql4(inp, 0 ,len, 0 , MODE_EMA ,i);
   }
}

  
//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction ( const MqlTradeTransaction & trans,
                         const MqlTradeRequest & request,
                         const MqlTradeResult & result)
  {
//---
   
  }
//+------------------------------------------------------------------+


Перенос индикаторов из MQL4 в MQL5
Перенос индикаторов из MQL4 в MQL5
  • 2010.07.21
  • Vasily
  • www.mql5.com
Статья посвящена особенностям переноса в MQL5 ценовых конструкций, используемых в индикаторах, написанных на MQL4. Для упрощения переноса индикаторных расчетов из MQL4 в MQL5 предложена библиотека функций mql4_2_mql5.mqh, применение которой рассмотрено на примере переноса индикаторов MACD, Stochastic и RSI.
파일:
FT.mq5  8 kb
FT.mq4  5 kb
 

다음은 이 블록의 예입니다.

 int start( int rates_total,
         int prev_calculated, 
         double &fisher[],
         double &stoch[],
         double &value1[],
         double &f[],
         int mode,
         int stochPeriod,
         int stochMode,
         int smoothType1,
         int smoothPeriod1,
         double k,
         int smoothType2,
         int smoothPeriod2,
         int buffers,
         int drawBegin)


{
   if (rates_total <= stochPeriod)  
       return ( 0 );
   int countedBars = prev_calculated;
   if (countedBars < 0 ) 
       return (- 1 );
   if (countedBars > 0 ) 
      countedBars--;
   int s, limit = rates_total - countedBars - 1 ;
   for (s = limit; s >= 0 ; s--) 
   {
       double price = P(s);
       double MaxH = price;
       double MinL = price;
       for ( int i = 0 ; i < stochPeriod; i++) 
      {
         if (stochMode == 0 )
         {
         price = P(s + i);
         if (price > MaxH) 
            MaxH = price;
         if (price < MinL) 
            MinL = price;
         }
         else
         {
            MaxH = MathMax (MaxH,High[s+i]);
            MinL = MathMin (MinL,Low[s+i]);
         }
      }
      stoch[s] = 2.0 * ((P(s) - MinL) / (MaxH - MinL) - 0.5 );
   }
  smooth(stoch,value1,smoothType1,smoothPeriod1,limit);

///'stoch' - parameter conversion not allowed   FT.mq5  173     10

   for (s = limit; s >= 0 ; s--)
   {
      f[s] = MathLog (( 1.0 + val(Value1[s])) / ( 1.0 - val(Value1[s]))) / 2.0 ;
   }    
   smooth(f,fisher,smoothType2,smoothPeriod2,limit);

///'f' - parameter conversion not allowed       FT.mq5  178     11

   return ( 0 );
}

뒤에 컴파일러의 메시지를 끼웠습니다. 윤곽.

stoch, f는 배열 요소로 미리 정의된 것 같습니다. 대괄호 뒤에 대괄호를 넣으면 오류가 더 아래로 내려갑니다.

'smoothType1' - 매개변수 변환이 허용되지 않습니다. FT.mq5 173 25


, 그리고 그것은 확실히 변수일 뿐입니다. 캐치 뭔데?

 
Agat :

여기 블록이...

 if (stochMode == 0 )
         {

         }
         else
         {

         };

";"의 정확성을 다시 확인하십시오. , 그들과 괄호(누락/불필요)로 인해 오류가 코드를 통해 "부동"할 수 있습니다.

Upd는 라이브러리를 통해 전송하는 것보다 5th에서 한 번에 작성하는 것이 더 쉬울 수 있습니다. 요컨대, 더 적은 문제가 있을 것입니다.

 

예, 여기 데이터베이스에는 Fisher Transform과 비슷한 것이 있지만 설정이 전혀 없습니다. 최소한 ENUM_APPLIED_PRICE를 변경해야 하지만 작동하지 않습니다.

어떻게 바꾸는지 알려주실 수 있나요?

https://www.mql5.com/en/code/537?source=terminal5_mql5


Индикатор Fisher Transform
Индикатор Fisher Transform
  • 투표: 8
  • 2011.10.10
  • Witold Wozniak
  • www.mql5.com
Индикатор Fisher, рассчитывая минимальные и максимальные уровни цены в предыдущей истории, определяет силу и направление тренда, прогнозируя его смену.
 

Fisher Transform에서 몇 줄을 추가하고 그 중 하나를 수동으로 선택하면

//가격=(높은[막대]+낮은[막대])/2.0;
//가격=(고가[막대]+하한[막대]+종가[막대])/3.0;

//가격=(고가[막대]+하한[막대]+종가[막대]+종가[막대])/4.0;

그리고 입력 리벳을 통해 삽입하기에 충분하지 않습니다.

 
Agat :

Fisher Transform에서 몇 줄을 추가하고 그 중 하나를 수동으로 선택하면

//가격=(높은[막대]+낮은[막대])/2.0;
//가격=(고가[막대]+하한[막대]+종가[막대])/3.0;

//가격=(고가[막대]+하한[막대]+종가[막대]+종가[막대])/4.0;

그리고 입력 리벳을 통해 삽입하기에 충분하지 않습니다.

 //+------------------------------------------------------------------+
//| inputs                                                           |
//+------------------------------------------------------------------+
enum var_ratio
  {
   O_HLC,                                 // Open
   O_H_LC                                 // Hight
// продолжите список
  };

input var_ratio             OHLC_var=O_HLC;             // variant
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
if (OHLC_var==O_HLC)
{};

그게 어떻게 가능해
 

고맙습니다! 물론 노력하겠지만 그게 핵심은 아닙니다. 그림이 MT-4와 전혀 같지 않습니다. 그게 문제입니다. 설정이 충분하지 않거나 계산 알고리즘이 다릅니다.

 
아니면 맨 아래 사진 에 막대가 더 많기 때문인가요?
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Стили рисования
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Стили рисования
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Стили рисования - Документация по MQL5
 
Agat :
아니면 아래 사진 에 막대가 더 많기 때문인가요?

표시기가 4의 번역이 아닌 경우 특히 다른 수의 막대에서 그림이 일치해야 하는 이유는 무엇입니까?

공식 및 설정을 확인하십시오. 그리고 지표의 저자에게 연락을 시도하십시오. 지표에 대한 논의에서 그는 아마도 무엇을 말할 것입니다.