MQL5 Wizard. Как правильно заблокировать сигнал,чтобы советник не торговал?
и Вам нужно, как минимум приложить код Ваших изысканий и описать торговые условия для воспроизведения результата?
В том-то и дело, что речь не о моем коде, а о стандартном, сгенерированном в MQL5 Wizard. Условия для воспроизведения описал выше. Что-то необходимо дополнить?
В том-то и дело, что речь не о моем коде, а о стандартном, сгенерированном в MQL5 Wizard. Условия для воспроизведения описал выше. Что-то необходимо дополнить?
Предоставьте код в который Вы вмешивались руками. Предоставьте описание торговых условий для возможности воспроизведения.
Предоставьте код в который Вы вмешивались руками. Предоставьте описание торговых условий для возможности воспроизведения.
SignalMACD.mqh
//+------------------------------------------------------------------+ //| "Voting" that price will grow. | //+------------------------------------------------------------------+ int CSignalMACD::LongCondition(void) { int result=0; int idx =StartIndex(); //--- check direction of the main line if(DiffMain(idx)>0.0) { //--- the main line is directed upwards, and it confirms the possibility of price growth if(IS_PATTERN_USAGE(0)) result=m_pattern_0; // "confirming" signal number 0 //--- if the model 1 is used, look for a reverse of the main line if(IS_PATTERN_USAGE(1) && DiffMain(idx+1)<0.0) result=m_pattern_1; // signal number 1 //--- if the model 2 is used, look for an intersection of the main and signal line if(IS_PATTERN_USAGE(2) && State(idx)>0.0 && State(idx+1)<0.0) result=m_pattern_2; // signal number 2 //--- if the model 3 is used, look for an intersection of the main line and the zero level if(IS_PATTERN_USAGE(3) && Main(idx)>0.0 && Main(idx+1)<0.0) result=m_pattern_3; // signal number 3 //--- if the models 4 or 5 are used and the main line turned upwards below the zero level, look for divergences if((IS_PATTERN_USAGE(4) || IS_PATTERN_USAGE(5)) && Main(idx)<0.0) { //--- perform the extended analysis of the oscillator state ExtState(idx); //--- if the model 4 is used, look for the "divergence" signal if(IS_PATTERN_USAGE(4) && CompareMaps(1,1)) // 0000 0001b result=m_pattern_4; // signal number 4 //--- if the model 5 is used, look for the "double divergence" signal if(IS_PATTERN_USAGE(5) && CompareMaps(0x11,2)) // 0001 0001b return(m_pattern_5); // signal number 5 } } //--- return the result // return(result); return(0); }
и аналогично в
//+------------------------------------------------------------------+ //| "Voting" that price will fall. | //+------------------------------------------------------------------+ int CSignalMACD::ShortCondition(void) ... //--- return the result // return(result); return(0);
Замена одной строчки:
// return(result); на return(0);
SignalMACD.mqh
и аналогично в
Сделайте так:
//+------------------------------------------------------------------+ //| "Voting" that price will grow. | //+------------------------------------------------------------------+ int CSignalMACD::LongCondition(void) { int result=0; return(result); int idx =StartIndex(); //--- check direction of the main line if(DiffMain(idx)>0.0) { //--- the main line is directed upwards, and it confirms the possibility of price growth if(IS_PATTERN_USAGE(0)) result=m_pattern_0; // "confirming" signal number 0 //--- if the model 1 is used, look for a reverse of the main line if(IS_PATTERN_USAGE(1) && DiffMain(idx+1)<0.0) result=m_pattern_1; // signal number 1 //--- if the model 2 is used, look for an intersection of the main and signal line if(IS_PATTERN_USAGE(2) && State(idx)>0.0 && State(idx+1)<0.0) result=m_pattern_2; // signal number 2 //--- if the model 3 is used, look for an intersection of the main line and the zero level if(IS_PATTERN_USAGE(3) && Main(idx)>0.0 && Main(idx+1)<0.0) result=m_pattern_3; // signal number 3 //--- if the models 4 or 5 are used and the main line turned upwards below the zero level, look for divergences if((IS_PATTERN_USAGE(4) || IS_PATTERN_USAGE(5)) && Main(idx)<0.0) { //--- perform the extended analysis of the oscillator state ExtState(idx); //--- if the model 4 is used, look for the "divergence" signal if(IS_PATTERN_USAGE(4) && CompareMaps(1,1)) // 0000 0001b result=m_pattern_4; // signal number 4 //--- if the model 5 is used, look for the "double divergence" signal if(IS_PATTERN_USAGE(5) && CompareMaps(0x11,2)) // 0001 0001b return(m_pattern_5); // signal number 5 } } //--- return the result return(result); } //+------------------------------------------------------------------+ //| "Voting" that price will fall. | //+------------------------------------------------------------------+ int CSignalMACD::ShortCondition(void) { int result=0; return(result); int idx =StartIndex(); //--- check direction of the main line if(DiffMain(idx)<0.0) { //--- main line is directed downwards, confirming a possibility of falling of price if(IS_PATTERN_USAGE(0)) result=m_pattern_0; // "confirming" signal number 0 //--- if the model 1 is used, look for a reverse of the main line if(IS_PATTERN_USAGE(1) && DiffMain(idx+1)>0.0) result=m_pattern_1; // signal number 1 //--- if the model 2 is used, look for an intersection of the main and signal line if(IS_PATTERN_USAGE(2) && State(idx)<0.0 && State(idx+1)>0.0) result=m_pattern_2; // signal number 2 //--- if the model 3 is used, look for an intersection of the main line and the zero level if(IS_PATTERN_USAGE(3) && Main(idx)<0.0 && Main(idx+1)>0.0) result=m_pattern_3; // signal number 3 //--- if the models 4 or 5 are used and the main line turned downwards above the zero level, look for divergences if((IS_PATTERN_USAGE(4) || IS_PATTERN_USAGE(5)) && Main(idx)>0.0) { //--- perform the extended analysis of the oscillator state ExtState(idx); //--- if the model 4 is used, look for the "divergence" signal if(IS_PATTERN_USAGE(4) && CompareMaps(1,1)) // 0000 0001b result=m_pattern_4; // signal number 4 //--- if the model 5 is used, look for the "double divergence" signal if(IS_PATTERN_USAGE(5) && CompareMaps(0x11,2)) // 0001 0001b return(m_pattern_5); // signal number 5 } } //--- return the result return(result); }
то есть сразу возврат нуля - чтобы паттерн 5 не вмешивался.
Сделайте так:
то есть сразу возврат нуля - чтобы паттерн 5 не вмешивался.
Чтобы все паттерны не вмешивались. Это искусственная ситуация, чтобы выявить проблему.
Вообще, цель добавить фильтр тренда (и разобраться в целом).
Чтобы все паттерны не вмешивались. Это искусственная ситуация, чтобы выявить проблему.
Вообще, цель добавить фильтр тренда (и разобраться в целом).
Сделайте как я показал и Вы отключите полностью модуль сигналов.
Сделайте как я показал и Вы отключите полностью модуль сигналов.
Да, спасибо, так срабатывает. И так будет рациональнее - зачем тратить процессорное время на ненужные расчеты, если в итоге будет ноль. Светлая голова.
Да, спасибо, так срабатывает. И так будет рациональнее - зачем тратить процессорное время на ненужные расчеты, если в итоге будет ноль. Светлая голова.
Определитесь пожалуйста с целью Ваших вопросов. И с названием темы. Вы спросили - Вам ответили.
Только сейчас заметил, что строчка в 5 паттерне отличается от остальных.
Везде result=m_pattern_0...4
а в последнем return(m_pattern_5);
Моя невнимательность. Спасибо за помощь. (Изменил название темы)

- Бесплатные приложения для трейдинга
- 8 000+ сигналов для копирования
- Экономические новости для анализа финансовых рынков
Вы принимаете политику сайта и условия использования
Советник продолжает торговать после того, как я полностью блокирую сигналы в соответствующем mqh. Я что-то не так делаю?
Надеюсь, профи помогут разобраться.
Чтобы проиллюстрировать проблему, создаю обычный советник с помощью MQL Wizard на Signals of oscillator 'MACD':
Затем, соответственно, в SignalMACD.mqh в
LongCondition и
ShortCondition
меняю
// return(result); на
return(0);
Все, никакие сигналы не должны возникать, но советник торгует в тестере. Сделок становится меньше, но они есть.
(Это не тот баг, который описывает Yuriy Lyachshenko 2020.06.12 22:43 #81, когда дорисовываются сделки из истории. Специально новый счет, история пустая).
Во вложении два скрина. 1 исходный советник, 2 заблокированный советник.
EURUSD, 1H
2020.02.04 — 2020.06.16
Open prices only
MACD(8,250,106,PRICE_CLOSE)
(build 2485 server BCS5-Real)