MQL4 및 MQL5에 대한 초보자 질문, 알고리즘 및 코드에 대한 도움말 및 토론 - 페이지 232

 
Rustam Bikbulatov :
두번째. 주문을 여는 명령

불분명하다. 시장가 주문은 어디에 있습니까? 지표를 호출 할까요? 그런 다음 표시기를 다시 만들고 iMACD 대신 iCustom으로 호출합니다.

이 장점의 코드베이스에서 아무 것도 다시 할 필요가 없을 수도 있습니다. 적어도 당신은 막혔습니다.

 
Vitalie Postolache :

불분명하다. 시장가 주문은 어디에 있습니까? 지표를 호출 할까요? 그런 다음 표시기를 다시 만들고 iMACD 대신 iCustom으로 호출합니다.

이 장점의 코드베이스에서 아무 것도 다시 할 필요가 없을 수도 있습니다. 적어도 당신은 막혔습니다.


iCustom을 통해 시도했지만 느리게 작동합니다. 지연이 큽니다. iMAOnArray를 통해 시도했지만 어레이에 문제가 있습니다. 며칠 동안 모든 것을 정리할 수 없었습니다. iMACD 를 만드는 것이 더 쉽지만 질문은

 
Rustam Bikbulatov :

iCustom을 통해 시도했지만 느리게 작동합니다. 지연이 큽니다. iMAOnArray를 통해 시도했지만 어레이에 문제가 있습니다. 며칠 동안 모든 것을 정리할 수 없었습니다. iMACD 를 만드는 것이 더 쉽지만 질문은


아니오, 표준 iMACD는 SMA 공식을 사용하여 신호 라인 을 계산합니다. 사용자 정의만 도움이 될 것입니다.

 
Vitalie Postolache :

아니오, 표준 iMACD는 SMA 공식을 사용하여 신호 라인 을 계산합니다. 사용자 정의만 도움이 될 것입니다.


어쨌든, 나는 이것이 불가능하다는 것을 깨달았습니다. 많은 정보 감사합니다

 
Rustam Bikbulatov :

어쨌든, 나는 이것이 불가능하다는 것을 깨달았습니다. 많은 정보 감사합니다


예, 불가능한 것은 없습니다. 경계를 약간만 밀면 됩니다 )))

 
Rustam Bikbulatov :

어쨌든, 나는 이것이 불가능하다는 것을 깨달았습니다. 많은 정보 감사합니다

다음은 표준 MACD 코드입니다.

 //+------------------------------------------------------------------+
//|                                                  Custom MACD.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright    "2005-2014, MetaQuotes Software Corp."
#property link          "http://www.mql4.com"
#property description "Moving Averages Convergence/Divergence"
#property strict

#include <MovingAverages.mqh>

//--- indicator settings
#property   indicator_separate_window
#property   indicator_buffers 2
#property   indicator_color1  Silver
#property   indicator_color2  Red
#property   indicator_width1   2
//--- indicator parameters
input int InpFastEMA= 12 ;   // Fast EMA Period
input int InpSlowEMA= 26 ;   // Slow EMA Period
input int InpSignalSMA= 9 ;   // Signal SMA Period
//--- indicator buffers
double     ExtMacdBuffer[];
double     ExtSignalBuffer[];
//--- right input parameters flag
bool       ExtParameters= false ;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit ( void )
  {
   IndicatorDigits ( Digits + 1 );
//--- drawing settings
   SetIndexStyle ( 0 , DRAW_HISTOGRAM );
   SetIndexStyle ( 1 , DRAW_LINE );
   SetIndexDrawBegin ( 1 ,InpSignalSMA);
//--- indicator buffers mapping
   SetIndexBuffer ( 0 ,ExtMacdBuffer);
   SetIndexBuffer ( 1 ,ExtSignalBuffer);
//--- name for DataWindow and indicator subwindow label
   IndicatorShortName ( "MACD(" + IntegerToString (InpFastEMA)+ "," + IntegerToString (InpSlowEMA)+ "," + IntegerToString (InpSignalSMA)+ ")" );
   SetIndexLabel ( 0 , "MACD" );
   SetIndexLabel ( 1 , "Signal" );
//--- check for input parameters
   if (InpFastEMA<= 1 || InpSlowEMA<= 1 || InpSignalSMA<= 1 || InpFastEMA>=InpSlowEMA)
     {
       Print ( "Wrong input parameters" );
      ExtParameters= false ;
       return ( INIT_FAILED );
     }
   else
      ExtParameters= true ;
//--- initialization done
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
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 i,limit;
//---
   if (rates_total<=InpSignalSMA || !ExtParameters)
       return ( 0 );
//--- last counted bar will be recounted
   limit=rates_total-prev_calculated;
   if (prev_calculated> 0 )
      limit++;
//--- macd counted in the 1-st buffer
   for (i= 0 ; i<limit; i++)
      ExtMacdBuffer[i]= iMA ( NULL , 0 ,InpFastEMA, 0 , MODE_EMA , PRICE_CLOSE ,i)-
                     iMA ( NULL , 0 ,InpSlowEMA, 0 , MODE_EMA , PRICE_CLOSE ,i);
//--- signal line counted in the 2-nd buffer
   SimpleMAOnBuffer(rates_total,prev_calculated, 0 ,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer);
   //ExponentialMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer);
//--- done
   return (rates_total);
  }
//+------------------------------------------------------------------+

분홍색으로 표시된 선은 내가 추가한 것입니다.

분홍색으로 표시된 라인의 주석 을 제거하고 녹색으로 표시된 라인을 주석 처리하면 MACD는 지수 MA를 사용하여 완전히 계산되어야 합니다.

 
Artyom Trishkin :

다음은 표준 MACD 코드입니다.

분홍색으로 표시된 선은 내가 추가한 것입니다.

분홍색으로 표시된 라인의 주석 을 제거하고 녹색으로 표시된 라인을 주석 처리하면 MACD는 지수 MA를 사용하여 완전히 계산되어야 합니다.


문제는 고문에서 그것을하는 방법이었습니다. EA 는 SMA 공식에 따라 자동으로 계산합니다.

 
Rustam Bikbulatov :

문제는 고문에서 그것을하는 방법이었습니다. EA 는 SMA 공식에 따라 자동으로 계산합니다.

커스텀 MACD를 만드는 방법을 알려드렸습니다.

여기 있고 iCustom()을 통해 고문에게 가져갑니다.

 
Artyom Trishkin :

커스텀 MACD를 만드는 방법을 알려 드렸습니다.

여기 있고 iCustom()을 통해 고문에게 가져갑니다.


데이터가 많고 부시가 느려집니다. 나는 이미 시도했다. 결과에 영향을 미칩니다. 어쨌든 감사합니다.

[삭제]  
Rustam Bikbulatov :

데이터가 많고 부시가 느려집니다. 나는 이미 시도했다. 결과에 영향을 미칩니다. 어쨌든 감사합니다.

설정을 확인하십시오. 표시할 막대가 너무 많아서 지연이 있을 수 있습니다.