Каждый модуль сигналов имеет две функции, в которых и происходит выдача сигналов на покупку или на продажу. Это "LongCondition" и "ShortCondition".
Я так понимаю в вашем советнике это:
int CSignalMA::LongCondition(void) { int result=0; int idx=StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); } //+------------------------------------------------------------------+ //| "Voting" that price will fall. | //+------------------------------------------------------------------+ int CSignalMA::ShortCondition(void) { int result=0; int idx =StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); } //+------------------------------------------------------------------+
а где здесь строчка, которая отвечает за действие? И как изменить это свойство?
int CSignalMA::LongCondition(void) { int result=0; int idx=StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); } //+------------------------------------------------------------------+ //| "Voting" that price will fall. | //+------------------------------------------------------------------+ int CSignalMA::ShortCondition(void) { int result=0; int idx =StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); } //+------------------------------------------------------------------+
а где здесь строчка, которая отвечает за действие? И как изменить это свойство?
Вы привели код НЕ ИЗ СОВЕТНИКА, а из МОДУЛЯ СИГНАЛОВ.
Для изменения направления сигнала в моём модуле менять ничего не нужно, так как в нём есть настройка "Reverse" - в зависимости от того, какое она имеет значение (true или false) сигналы могут меняться прямо на противоположные.
На примере "LongCondition":
если реверс ("m_reverse") равен true и цена закрытия минус значение индикатора больше нуля - то выдаём сигнал "Long" (Buy, покупка)
int CSignalMA::LongCondition(void) { int result=0; int idx=StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); }
Вы привели код НЕ ИЗ СОВЕТНИКА, а из МОДУЛЯ СИГНАЛОВ.
Для изменения направления сигнала в моём модуле менять ничего не нужно, так как в нём есть настройка "Reverse" - в зависимости от того, какое она имеет значение (true или false) сигналы могут меняться прямо на противоположные.
На примере "LongCondition":
если реверс ("m_reverse") равен true и цена закрытия минус значение индикатора больше нуля - то выдаём сигнал "Long" (Buy, покупка)
int CSignalMA::LongCondition(void) { int result=0; int idx=StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(m_reverse) if(DiffCloseMA(idx)>0.0) { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } if(!m_reverse) if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; } //--- return the result return(result); }
Владимир, появилась новая проблема. Советник ваш скомпилировался, но когда пытаюсь его перетянуть на график и соглашаюсь с настройками. В правом углу на какое то время появляется иконка что советник запущен. Потом сразу пропадает. В чем может быть причина? Отличная штука этот reverse. Как его можно применить в других советниках??
Владимир, появилась новая проблема. Советник ваш скомпилировался, но когда пытаюсь его перетянуть на график и соглашаюсь с настройками. В правом углу на какое то время появляется иконка что советник запущен. Потом сразу пропадает. В чем может быть причина? Отличная штука этот reverse. Как его можно применить в других советниках??
Ищите сообщения об ошибках в окне терминала "Инструменты" во вкладках "Эксперты" и "Журнал"...
Я так понимаю вот раздел, который отвечает за открытие позиции если "цена будет расти" в файле SignalMA.mqh ?
//+------------------------------------------------------------------+ //| "Voting" that price will grow. | //+------------------------------------------------------------------+ int CSignalMA::LongCondition(void) { int result=0; int idx =StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0) { //--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards result=m_pattern_1; //--- consider that this is an unformed "piercing" and suggest to enter the market at the current price m_base_price=0.0; } } else { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; //--- if the indicator is directed upwards if(DiffMA(idx)>0.0) { if(DiffOpenMA(idx)<0.0) { //--- if the model 2 is used if(IS_PATTERN_USAGE(2)) { //--- the open price is below the indicator (i.e. there was an intersection) result=m_pattern_2; //--- suggest to enter the market at the "roll back" m_base_price=m_symbol.NormalizePrice(MA(idx)); } } else { //--- if the model 3 is used and the open price is above the indicator if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0) { //--- the low price is below the indicator result=m_pattern_3; //--- consider that this is a formed "piercing" and suggest to enter the market at the current price m_base_price=0.0; } } } } //--- return the result return(result); }
Что если заменить это кодом из вашего модуля, будет ли работать корректно. Дело в том что содержание немного отличается от вашего. Здесь больше кода.. хм
Я так понимаю вот раздел, который отвечает за открытие позиции если "цена будет расти" в файле SignalMA.mqh ?
//+------------------------------------------------------------------+ //| "Voting" that price will grow. | //+------------------------------------------------------------------+ int CSignalMA::LongCondition(void) { int result=0; int idx =StartIndex(); //--- analyze positional relationship of the close price and the indicator at the first analyzed bar if(DiffCloseMA(idx)<0.0) { //--- the close price is below the indicator if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0) { //--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards result=m_pattern_1; //--- consider that this is an unformed "piercing" and suggest to enter the market at the current price m_base_price=0.0; } } else { //--- the close price is above the indicator (the indicator has no objections to buying) if(IS_PATTERN_USAGE(0)) result=m_pattern_0; //--- if the indicator is directed upwards if(DiffMA(idx)>0.0) { if(DiffOpenMA(idx)<0.0) { //--- if the model 2 is used if(IS_PATTERN_USAGE(2)) { //--- the open price is below the indicator (i.e. there was an intersection) result=m_pattern_2; //--- suggest to enter the market at the "roll back" m_base_price=m_symbol.NormalizePrice(MA(idx)); } } else { //--- if the model 3 is used and the open price is above the indicator if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0) { //--- the low price is below the indicator result=m_pattern_3; //--- consider that this is a formed "piercing" and suggest to enter the market at the current price m_base_price=0.0; } } } } //--- return the result return(result); }
Что если заменить это кодом из вашего модуля, будет ли работать корректно. Дело в том что содержание немного отличается от вашего. Здесь больше кода.. хм
Если просто взять мой код и вставить сюда - работать не будет.
Если Вы хотите поменять сигналы на обратные в стандартном модуле сигналов:
создайте копию файла с другим именем
измените описание модуля
// wizard description start //+------------------------------------------------------------------+ //| Description of the class | //| Title=*** | //| Type=SignalAdvanced | //| Name=Moving Average |
просто замените названия функций : LongCondition <--> ShortCondition
Владимир, спасибо, вы очень помогли. Теперь вопрос остается как сделать заявки тейк профит и стоп-лосс которые советник расставляет. Как их сделать лимитными?
Для авторизации и пользования сайтом MQL5.com необходимо разрешить использование файлов Сookie.
Пожалуйста, включите в вашем браузере данную настройку, иначе вы не сможете авторизоваться.
Вы вошли в аккаунт. Двухфакторная аутентификация отключена. Настройте её заново и отсканируйте новый QR-код или продолжите с отключённой двухфакторной аутентификацией.
Владимир, разобрался, запустил. А где здесь можно поменять ордера на продажу ордерами на покупку?
Каждый модуль сигналов имеет две функции, в которых и происходит выдача сигналов на покупку или на продажу. Это "LongCondition" и "ShortCondition".
Каждый модуль сигналов имеет две функции, в которых и происходит выдача сигналов на покупку или на продажу. Это "LongCondition" и "ShortCondition".
Я так понимаю в вашем советнике это:
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
//| "Voting" that price will fall. |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
а где здесь строчка, которая отвечает за действие? И как изменить это свойство?
Я так понимаю в вашем советнике это:
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
//| "Voting" that price will fall. |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
//+------------------------------------------------------------------+
а где здесь строчка, которая отвечает за действие? И как изменить это свойство?
Код пожалуйста вставляйте правильно: Правильно вставляем код на форуме
Вы привели код НЕ ИЗ СОВЕТНИКА, а из МОДУЛЯ СИГНАЛОВ.
Для изменения направления сигнала в моём модуле менять ничего не нужно, так как в нём есть настройка "Reverse" - в зависимости от того, какое она имеет значение (true или false) сигналы могут меняться прямо на противоположные.
На примере "LongCondition":
если реверс ("m_reverse") равен true и цена закрытия минус значение индикатора больше нуля - то выдаём сигнал "Long" (Buy, покупка)
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
Код пожалуйста вставляйте правильно: Правильно вставляем код на форуме
Вы привели код НЕ ИЗ СОВЕТНИКА, а из МОДУЛЯ СИГНАЛОВ.
Для изменения направления сигнала в моём модуле менять ничего не нужно, так как в нём есть настройка "Reverse" - в зависимости от того, какое она имеет значение (true или false) сигналы могут меняться прямо на противоположные.
На примере "LongCondition":
если реверс ("m_reverse") равен true и цена закрытия минус значение индикатора больше нуля - то выдаём сигнал "Long" (Buy, покупка)
{
int result=0;
int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(m_reverse)
if(DiffCloseMA(idx)>0.0)
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
if(!m_reverse)
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
}
//--- return the result
return(result);
}
Владимир, появилась новая проблема. Советник ваш скомпилировался, но когда пытаюсь его перетянуть на график и соглашаюсь с настройками. В правом углу на какое то время появляется иконка что советник запущен. Потом сразу пропадает. В чем может быть причина? Отличная штука этот reverse. Как его можно применить в других советниках??
Владимир, появилась новая проблема. Советник ваш скомпилировался, но когда пытаюсь его перетянуть на график и соглашаюсь с настройками. В правом углу на какое то время появляется иконка что советник запущен. Потом сразу пропадает. В чем может быть причина? Отличная штука этот reverse. Как его можно применить в других советниках??
Ищите сообщения об ошибках в окне терминала "Инструменты" во вкладках "Эксперты" и "Журнал"...
Я так понимаю вот раздел, который отвечает за открытие позиции если "цена будет расти" в файле SignalMA.mqh ?
//| "Voting" that price will grow. |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator
if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
{
//--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
result=m_pattern_1;
//--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
else
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
//--- if the indicator is directed upwards
if(DiffMA(idx)>0.0)
{
if(DiffOpenMA(idx)<0.0)
{
//--- if the model 2 is used
if(IS_PATTERN_USAGE(2))
{
//--- the open price is below the indicator (i.e. there was an intersection)
result=m_pattern_2;
//--- suggest to enter the market at the "roll back"
m_base_price=m_symbol.NormalizePrice(MA(idx));
}
}
else
{
//--- if the model 3 is used and the open price is above the indicator
if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
{
//--- the low price is below the indicator
result=m_pattern_3;
//--- consider that this is a formed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
}
}
//--- return the result
return(result);
}
Что если заменить это кодом из вашего модуля, будет ли работать корректно. Дело в том что содержание немного отличается от вашего. Здесь больше кода.. хм
Я так понимаю вот раздел, который отвечает за открытие позиции если "цена будет расти" в файле SignalMA.mqh ?
//| "Voting" that price will grow. |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
{
int result=0;
int idx =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
if(DiffCloseMA(idx)<0.0)
{
//--- the close price is below the indicator
if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
{
//--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
result=m_pattern_1;
//--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
else
{
//--- the close price is above the indicator (the indicator has no objections to buying)
if(IS_PATTERN_USAGE(0))
result=m_pattern_0;
//--- if the indicator is directed upwards
if(DiffMA(idx)>0.0)
{
if(DiffOpenMA(idx)<0.0)
{
//--- if the model 2 is used
if(IS_PATTERN_USAGE(2))
{
//--- the open price is below the indicator (i.e. there was an intersection)
result=m_pattern_2;
//--- suggest to enter the market at the "roll back"
m_base_price=m_symbol.NormalizePrice(MA(idx));
}
}
else
{
//--- if the model 3 is used and the open price is above the indicator
if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
{
//--- the low price is below the indicator
result=m_pattern_3;
//--- consider that this is a formed "piercing" and suggest to enter the market at the current price
m_base_price=0.0;
}
}
}
}
//--- return the result
return(result);
}
Что если заменить это кодом из вашего модуля, будет ли работать корректно. Дело в том что содержание немного отличается от вашего. Здесь больше кода.. хм
Если просто взять мой код и вставить сюда - работать не будет.
Если просто взять мой код и вставить сюда - работать не будет.
Если просто взять мой код и вставить сюда - работать не будет.
Владимир, куда нужно вставить реверс, чтобы все заработало?
Понятно, что нужно будет создать копию файла, поменять название инклуда этого.
Если Вы хотите поменять сигналы на обратные в стандартном модуле сигналов:
//+------------------------------------------------------------------+
//| Description of the class |
//| Title=*** |
//| Type=SignalAdvanced |
//| Name=Moving Average |
Если Вы хотите поменять сигналы на обратные в стандартном модуле сигналов:
//+------------------------------------------------------------------+
//| Description of the class |
//| Title=*** |
//| Type=SignalAdvanced |
//| Name=Moving Average |
Владимир, спасибо, вы очень помогли. Теперь вопрос остается как сделать заявки тейк профит и стоп-лосс которые советник расставляет. Как их сделать лимитными?