초보자의 질문 MQL5 MT5 MetaTrader 5 - 페이지 893

 
Andy :

여기에서 신호 모듈을 선택하고 매개변수를 미리 볼 때 끝에서 두 번째 매개변수가 나타나지만 마지막 매개변수는 나타나지 않습니다(오류 없음, 컴파일 경고 없음).

아무것도 명확하지 않습니다. 색상 도구로 텍스트 강조 표시

그렇지 않으면 누가 "마지막 매개변수"이고 누가 "마지막"인지 이해할 수 없습니다.

 
작동하지 않는 라인을 강조 표시했습니다.
 
Andy :
작동하지 않는 라인을 강조 표시했습니다.

솔루션은 다음과 같습니다. 신호 모듈에서

 //+------------------------------------------------------------------+
//|                                                    SignalRSI.mqh |
//|                   Copyright 2009-2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#include <Expert\ExpertSignal.mqh>
// wizard description start
//+------------------------------------------------------------------+
//| Description of the class                                         |
//| Title=Signals of oscillator 'Relative Strength Index'            |
//| Type=SignalAdvanced                                              |
//| Name=Relative Strength Index                                     |
//| ShortName=RSI                                                    |
//| Class=CSignalRSI                                                 |
//| Page=signal_rsi                                                  |
//| Parameter=PeriodRSI,int,8,Period of calculation                  |
//| Parameter=Applied,ENUM_APPLIED_PRICE,PRICE_CLOSE,Prices series   |
//| Parameter=Intervals,int,1,Type of intervals                      |
//+------------------------------------------------------------------+
// wizard description end
//+------------------------------------------------------------------+
//| Class CSignalRSI.                                                |
//| Purpose: Class of generator of trade signals based on            |
//|          the 'Relative Strength Index' oscillator.               |
//| Is derived from the CExpertSignal class.                         |
//+------------------------------------------------------------------+
class CSignalRSI : public CExpertSignal
  {
protected :
   CiRSI             m_rsi;             // object-oscillator
   //--- adjusted parameters
   int                m_periodRSI;       // the "period of calculation" parameter of the oscillator
   ENUM_APPLIED_PRICE m_applied;       // the "prices series" parameter of the oscillator
   int                m_intervals;       //
   //--- "weights" of market models (0-100)
   int                m_pattern_0;       // model 0 "the oscillator has required direction"
   int                m_pattern_1;       // model 1 "reverse behind the level of overbuying/overselling"
   int                m_pattern_2;       // model 2 "failed swing"
   int                m_pattern_3;       // model 3 "divergence of the oscillator and price"
   int                m_pattern_4;       // model 4 "double divergence of the oscillator and price"
   int                m_pattern_5;       // model 5 "head/shoulders"
   //--- variables
   double             m_extr_osc[ 10 ];   // array of values of extremums of the oscillator
   double             m_extr_pr[ 10 ];     // array of values of the corresponding extremums of price
   int                m_extr_pos[ 10 ];   // array of shifts of extremums (in bars)
   uint               m_extr_map;       // resulting bit-map of ratio of extremums of the oscillator and the price

public :
                     CSignalRSI( void );
                    ~CSignalRSI( void );
   //--- methods of setting adjustable parameters
   void               PeriodRSI( int value )              { m_periodRSI= value ;           }
   void               Applied(ENUM_APPLIED_PRICE value ) { m_applied= value ;             }
   void               Intervals( int value )              { m_intervals= value ;           }
   //--- methods of adjusting "weights" of market models
   void               Pattern_0( int value )              { m_pattern_0= value ;           }


MQL5 마법사에 의해 생성된 Expert Advisor에서:

 //+------------------------------------------------------------------+
//|                                                          RSI.mq5 |
//|                              Copyright © 2018, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2018, Vladimir Karputov"
#property link        "http://wmua.ru/slesar/"
#property version    "1.00"
//+------------------------------------------------------------------+
//| Include                                                          |
//+------------------------------------------------------------------+
#include <Expert\Expert.mqh>
//--- available signals
#include <Expert\Signal\SignalRSI.mqh>
//--- available trailing
#include <Expert\Trailing\TrailingNone.mqh>
//--- available money management
#include <Expert\Money\MoneyFixedLot.mqh>
//---
enum ENUM_intervals   // Enumeration of named constants 
  {
   month= 1 ,     // Interval of one month 
   two_months,   // Two months 
   quarter,     // Three months - quarter 
   halfyear= 6 ,   // Half a year 
   year= 12 ,     // Year - 12 months 
  };
//+------------------------------------------------------------------+
//| Inputs                                                           |
//+------------------------------------------------------------------+
//--- inputs for expert
input string              Expert_Title         = "RSI" ;       // Document name
ulong                     Expert_MagicNumber   = 13111 ;       // 
bool                      Expert_EveryTick     = false ;       // 
//--- inputs for main signal
input int                 Signal_ThresholdOpen = 10 ;           // Signal threshold value to open [0...100]
input int                 Signal_ThresholdClose= 10 ;           // Signal threshold value to close [0...100]
input double              Signal_PriceLevel    = 0.0 ;         // Price level to execute a deal
input double              Signal_StopLevel     = 50.0 ;         // Stop Loss level (in points)
input double              Signal_TakeLevel     = 50.0 ;         // Take Profit level (in points)
input int                 Signal_Expiration    = 4 ;           // Expiration of pending orders (in bars)
input int                 Signal_RSI_PeriodRSI = 8 ;           // Relative Strength Index(8,...) Period of calculation
input ENUM_APPLIED_PRICE Signal_RSI_Applied   = PRICE_CLOSE ; // Relative Strength Index(8,...) Prices series
input ENUM_intervals     Signal_RSI_Intervals =month;       // Relative Strength Index(8,...) Type of intervals
input double              Signal_RSI_Weight    = 1.0 ;         // Relative Strength Index(8,...) Weight [0...1.0]
//--- inputs for money
input double              Money_FixLot_Percent = 10.0 ;         // Percent
input double              Money_FixLot_Lots    = 0.1 ;         // Fixed volume
//+------------------------------------------------------------------+
//| Global expert object                                             |
//+------------------------------------------------------------------+
CExpert ExtExpert;


결과:


 
글쎄요, 시그널 모듈 설명에 열거형을 이용 해서 입력 파라미터를 바로 설정할 수는 없나요?
 
Andy :
글쎄요, 시그널 모듈 설명에 열거형을 이용해서 입력 파라미터를 바로 설정할 수는 없나요?

'답장' 버튼 누르기 어렵나요? 당신이 누구에게 말하고 어떤 질문을 하고 있는지 명확히 하기 위해?

 
따라서 메시지가 차례로 전달되고 이것이 이전 메시지에 대한 답변임이 너무 분명하고 추가 인용문을 사용하는 것은 이미 과도한 인용부호를 사용하고 있는 것입니다.
 
Andy :
따라서 메시지가 차례로 전달되고 이것이 이전 메시지에 대한 답변이고 추가 인용문을 사용하는 것이 너무 분명하다면 이것은 이미 오버클럭킹된 것입니다.

대화를 종료했습니다. 공중에, 즉 아무에게도 묻지 마십시오.

 
Vladimir Karputov :

대화를 종료했습니다. 공중에, 즉 아무에게도 묻지 마십시오.

답이 없다는 뜻인가요? 모두에게 질문합니다.

 
Andy :
글쎄요, 시그널 모듈 설명에 열거형을 이용해서 입력 파라미터를 바로 설정할 수는 없나요?
할 수 있다.
 

어디에서 예를 찾을 수 있는지 알려주실 수 있습니까?

신호 모듈에서 열거형 형식으로 입력 매개변수 의 코드를 삽입하는 곳, 나중에 이 모듈의 설명자에서 지정할 수 있습니다.

 enum ENUM_AVAILABLE_POSITIONS
  {
   LONG_POSITION,
   SHORT_POSITION,
   BOTH_POSITION
  };
사유: