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

 
안녕하세요! 말해 주세요. 조건을 올바르게 작성하는 방법: *새로운 시간이 오면*?
 
MrBrooklin :

안녕하세요!

이해하도록 도와주세요. "시간 필터" 거래 신호 모듈에 대해 질문이 있습니다.

사실 이 모듈을 사용하여 어드바이저를 생성하고 하루에 한 시간만 거래할 수 있는 권한을 설정했습니다. 기본적으로 이렇게 거래하는데 어드바이저가 원하는 시간에 포지션을 오픈하는 날이 있습니다. 다른 거래 신호 모듈(예: Stochastic, WPR 등)과 다양한 조합으로 "시간 필터" 거래 신호 모듈을 적용하려고 했지만 동일한 일이 발생합니다. 더군다나 연속 2시간 근로 허용을 설정하면 문제 없이 깔끔하게 잘 나옵니다.

무엇으로 연결할 수 있습니까? "시간 필터" 거래 신호 모듈의 코드에 오류가 있습니까? 나는 프로그래밍 전문가가 아니기 때문에 내가 그것을 알아내는 데 도움을 요청하거나 나 자신에게 뭔가 잘못하고 있는 것일 수 있습니다.

안부 인사를 전합니다. 블라디미르.


다음은 그림의 좋은 예입니다. 어느 날은 7시에 열고, 다른 날은 17시에 열고, 셋째 날은 다시 7시에 열어 7시에만 열어야 합니다.


Expert Advisor를 mq5 메시지에 첨부하고 테스터 매개변수를 지정할 수 있습니까(두 스크린샷: 설정 및 매개변수 탭)?

 
Snajper007 :
안녕하세요! 말해 주세요. 조건을 올바르게 작성하는 방법: *새로운 시간이 오면*?

시간의 의미에서(예: 시계가 15-00을 표시함) 또는 H1 시간대에 새로운 막대 가 탄생했다는 의미에서?

 

거래, 자동 거래 시스템 및 거래 전략 테스트에 관한 포럼

초보자의 질문 MQL5 MT5 MetaTrader 5

블라디미르 카르푸토프 , 2019.10.14 12:04

Expert Advisor를 mq5 메시지에 첨부하고 테스터 매개변수를 지정할 수 있습니까(두 스크린샷: 설정 및 매개변수 탭)?


예를 들어 근거 없는 말을 하지 않기 위해 저는 지금 MQL5 마법사에서 AMA 거래 신호의 첫 번째 모듈과 시간 필터를 생성했습니다.

 //+------------------------------------------------------------------+
//|                                                          AMA.mq5 |
//|                        Copyright 2019, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property version    "1.00"
//+------------------------------------------------------------------+
//| Include                                                          |
//+------------------------------------------------------------------+
#include <Expert\Expert.mqh>
//--- available signals
#include <Expert\Signal\SignalAMA.mqh>
#include <Expert\Signal\SignalITF.mqh>
//--- available trailing
#include <Expert\Trailing\TrailingNone.mqh>
//--- available money management
#include <Expert\Money\MoneyFixedRisk.mqh>
//+------------------------------------------------------------------+
//| Inputs                                                           |
//+------------------------------------------------------------------+
//--- inputs for expert
input string              Expert_Title            = "AMA" ;                  // Document name
ulong                     Expert_MagicNumber      = 8503 ;                   //
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 ;                       // 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_AMA_PeriodMA     = 10 ;                     // Adaptive Moving Average(1,1,...) Period of averaging
input int                 Signal_AMA_PeriodFast   = 2 ;                       // Adaptive Moving Average(1,1,...) Period of fast EMA
input int                 Signal_AMA_PeriodSlow   = 30 ;                     // Adaptive Moving Average(1,1,...) Period of slow EMA
input int                 Signal_AMA_Shift        = 0 ;                       // Adaptive Moving Average(1,1,...) Time shift
input ENUM_APPLIED_PRICE Signal_AMA_Applied      = PRICE_CLOSE ;             // Adaptive Moving Average(1,1,...) Prices series
input double              Signal_AMA_Weight       = 1.0 ;                     // Adaptive Moving Average(1,1,...) Weight [0...1.0]
input int                 Signal_ITF_GoodHourOfDay=- 1 ;                     // IntradayTimeFilter(-1,...) Good hour
input int                 Signal_ITF_BadHoursOfDay= 16777087 ;               // IntradayTimeFilter(-1,...) Bad hours (bit-map)
input int                 Signal_ITF_GoodDayOfWeek=- 1 ;                     // IntradayTimeFilter(-1,...) Good day of week
input int                 Signal_ITF_BadDaysOfWeek= 0 ;                       // IntradayTimeFilter(-1,...) Bad days of week (bit-map)
input double              Signal_ITF_Weight       = 1.0 ;                     // IntradayTimeFilter(-1,...) Weight [0...1.0]
//--- inputs for money
input double              Money_FixRisk_Percent   = 10.0 ;                   // Risk percentage
//+------------------------------------------------------------------+
//| Global expert object                                             |
//+------------------------------------------------------------------+
CExpert ExtExpert;
//+------------------------------------------------------------------+
//| Initialization function of the expert                            |
//+------------------------------------------------------------------+
int OnInit ()
  {
//--- Initializing expert
   if (!ExtExpert.Init( Symbol (), Period (),Expert_EveryTick,Expert_MagicNumber))
     {
       //--- failed
       printf ( __FUNCTION__ + ": error initializing expert" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
//--- Creating signal
   CExpertSignal *signal= new CExpertSignal;
   if (signal== NULL )
     {
       //--- failed
       printf ( __FUNCTION__ + ": error creating signal" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
//---
   ExtExpert.InitSignal(signal);
   signal.ThresholdOpen(Signal_ThresholdOpen);
   signal.ThresholdClose(Signal_ThresholdClose);
   signal.PriceLevel(Signal_PriceLevel);
   signal.StopLevel(Signal_StopLevel);
   signal.TakeLevel(Signal_TakeLevel);
   signal.Expiration(Signal_Expiration);
//--- Creating filter CSignalAMA
   CSignalAMA *filter0= new CSignalAMA;
   if (filter0== NULL )
     {
       //--- failed
       printf ( __FUNCTION__ + ": error creating filter0" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
   signal.AddFilter(filter0);
//--- Set filter parameters
   filter0.PeriodMA(Signal_AMA_PeriodMA);
   filter0.PeriodFast(Signal_AMA_PeriodFast);
   filter0.PeriodSlow(Signal_AMA_PeriodSlow);
   filter0.Shift(Signal_AMA_Shift);
   filter0.Applied(Signal_AMA_Applied);
   filter0.Weight(Signal_AMA_Weight);
//--- Creating filter CSignalITF
   CSignalITF *filter1= new CSignalITF;
   if (filter1== NULL )
     {
       //--- failed
       printf ( __FUNCTION__ + ": error creating filter1" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
   signal.AddFilter(filter1);
//--- Set filter parameters
   filter1.GoodHourOfDay(Signal_ITF_GoodHourOfDay);
   filter1.BadHoursOfDay(Signal_ITF_BadHoursOfDay);
   filter1.GoodDayOfWeek(Signal_ITF_GoodDayOfWeek);
   filter1.BadDaysOfWeek(Signal_ITF_BadDaysOfWeek);
   filter1.Weight(Signal_ITF_Weight);
//--- Creation of trailing object
   CTrailingNone *trailing= new CTrailingNone;
   if (trailing== NULL )
     {
       //--- failed
       printf ( __FUNCTION__ + ": error creating trailing" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
//--- Add trailing to expert (will be deleted automatically))
   if (!ExtExpert.InitTrailing(trailing))
     {
       //--- failed
       printf ( __FUNCTION__ + ": error initializing trailing" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
//--- Set trailing parameters
//--- Creation of money object
   CMoneyFixedRisk *money= new CMoneyFixedRisk;
   if (money== NULL )
     {
       //--- failed
       printf ( __FUNCTION__ + ": error creating money" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
//--- Add money to expert (will be deleted automatically))
   if (!ExtExpert.InitMoney(money))
     {
       //--- failed
       printf ( __FUNCTION__ + ": error initializing money" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
//--- Set money parameters
   money.Percent(Money_FixRisk_Percent);
//--- Check all trading objects parameters
   if (!ExtExpert.ValidationSettings())
     {
       //--- failed
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
//--- Tuning of all necessary indicators
   if (!ExtExpert.InitIndicators())
     {
       //--- failed
       printf ( __FUNCTION__ + ": error initializing indicators" );
      ExtExpert.Deinit();
       return ( INIT_FAILED );
     }
//--- ok
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Deinitialization function of the expert                          |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
   ExtExpert.Deinit();
  }
//+------------------------------------------------------------------+
//| "Tick" event handler function                                    |
//+------------------------------------------------------------------+
void OnTick ()
  {
   ExtExpert. OnTick ();
  }
//+------------------------------------------------------------------+
//| "Trade" event handler function                                   |
//+------------------------------------------------------------------+
void OnTrade ()
  {
   ExtExpert. OnTrade ();
  }
//+------------------------------------------------------------------+
//| "Timer" event handler function                                   |
//+------------------------------------------------------------------+
void OnTimer ()
  {
   ExtExpert. OnTimer ();
  }
//+------------------------------------------------------------------+

"설정" 스크린샷


"설정" 스크린샷

잘못된 스크린샷 시간 필터 작동(7시, 12시 및 7시에 다른 요일에 위치가 열립니다)


 
MrBrooklin :

예를 들어 근거 없는 말을 하지 않기 위해 저는 지금 MQL5 마법사에서 AMA 거래 신호의 첫 번째 모듈과 시간 필터를 생성했습니다.

"설정" 스크린샷


"설정" 스크린샷

잘못된 시간 필터 작업의 스크린샷(7시, 12시 및 7시에 다른 요일에 위치가 열립니다)


1. 그래프가 있는 사진 - 스크린샷을 찍을 때 "Crosshair" 도구와 함께 하세요. 그렇지 않으면 몇 년도인지 명확하지 않습니다.

2. 보류 중인 주문으로 작업할 때 - 보류 중인 주문은 배치 시간과 관련하여 완전히 다른 시간(시간 및 분)에 작동할 수 있음을 기억하십시오.

3. 신호 모듈을 사용할 때 매개변수를 기본값으로 재설정하고 보류 중인 주문 없이 시장에서 작업을 확인합니다(포인트 2가 명확하지 않은 경우).

 

거래, 자동 거래 시스템 및 거래 전략 테스트에 관한 포럼

초보자의 질문 MQL5 MT5 MetaTrader 5

블라디미르 카르푸토프 , 2019.10.14 13:28

1. 그래프가 있는 사진 - 스크린샷을 찍을 때 "Crosshair" 도구와 함께 하세요. 그렇지 않으면 몇 년도인지 명확하지 않습니다.

2. 보류 중인 주문으로 작업할 때 - 보류 중인 주문은 배치 시간과 관련하여 완전히 다른 시간(시간 및 분)에 작동할 수 있음을 기억하십시오.

3. 신호 모듈을 사용할 때 매개변수를 기본값으로 재설정하고 보류 중인 주문 없이 시장에서 작업을 확인합니다(포인트 2가 명확하지 않은 경우).


1. 십자선에 관해서 - 이해할 수 있습니다. 스크린샷에서 연도는 2019년이고 월은 10월입니다.

2. 보류 중인 주문에 대해 잘 이해하지 못했습니다. 어드바이저가 보류 주문을 설정하고 시간이 시작될 때 즉시 포지션을 열지 않는다는 것을 어떻게 결정했습니까? 더 많을 수 있습니까?

3. 신호 모듈의 기본값을 사용하면 EA가 정상적으로 작동합니다. 매개변수 값을 변경할 수 있습니까?

안부 인사를 전합니다. 블라디미르.

 

***

1. 십자선에 관해서 - 이해할 수 있습니다. 스크린샷에서 연도는 2019년이고 월은 10월입니다.

***

설명해주셔서 감사합니다.

***

2. 보류 중인 주문에 대해 잘 이해하지 못했습니다. 고문이 보류 주문을 설정하고 시간이 시작될 때 즉시 포지션을 열지 않는다는 것을 어떻게 결정했습니까? 더 많을 수 있습니까?

***

비주얼 테스터에서 "히스토리" 탭을 살펴보세요.

기록 탭

***

3. 기본 신호 모듈 값으로 EA는 정상적으로 작동합니다. 매개변수 값을 변경할 수 있습니까?

***

물론 할 수 있지만, 수행 중인 작업을 이해하고 어떤 매개변수가 무엇을 담당하는지 이해한 경우에만 가능합니다.

 
Vladimir Karputov :

시간의 의미에서(예: 시계가 15-00을 표시함) 또는 H1 시간대에 새로운 막대 가 탄생했다는 의미에서?

내 말은, 시계는 15-00을 가리키고 있었다.
 
Snajper007 :
내 말은, 시계는 15-00을 가리키고 있었다.

그리고 어느 정도의 신뢰도로 결과가 필요합니까?

예: 시계에서 15-00시를 보고 싶습니다. 그리고 그것을 기대하십시오. 그러나 이때 틱이 없었거나 서버에 연결되지 않았습니다. 그리고 틱이 시작됐는데 시간은 벌써 15시 00분 36초. 당신은 무엇을 할 것인가?

 
Vladimir Karputov :

그리고 어느 정도의 신뢰도로 결과가 필요합니까?

예: 시계에서 15-00시를 보고 싶습니다. 그리고 그것을 기대하십시오. 그러나 이때 틱이 없었거나 서버에 연결되지 않았습니다. 그리고 틱이 시작됐는데 시간은 벌써 15시 00분 36초. 당신은 무엇을 할 것인가?

정확히 15시부터 00시까지가 아니라 시초에 체크하도록 할 수 있나요? 저것들. 그래서 첫 번째 순간에 이전 시간이 끝나고 새로운 시간이 시작되었다는 것이 이미 분명했습니다.
사유: