Como eu monto meu conselheiro por tentativa e erro - página 50

 
Alexsandr San:

Adicionado este recurso ao Utility ("Utility Command") #property version "1.004".

na parte inferior, configurações para esta função

nome da linha de tendência ou linha horizontal - para instalar o Indicador

nome do indicador - qual indicador você deseja instalar no gráfico

nome da linha horizontal ou de tendência do Indicador

-------------------------- o princípio do trabalho, deve ser o seguinte

----------------------- O indicador moverá a linha horizontal (azul) - se quebrar, abrirá em VENDA e removerá o indicador e definirá uma linha amarela, que será pega por outro indicador e moverá a linha para o nível roxo do indicador - depois do, amarelo horizontal, novamente definirá o indicador


A função funciona perfeitamente - a Utilidade, muito, muito, nada mal.

No entanto, é necessário acrescentar a esta função, mais ajustes, que definirão o Indicador, através do número de pontos a partir da posição aberta

Foto por

 
Alexsandr San:

Adicionado este recurso ao Utility ("Utility Command") #property version "1.004".

na parte inferior, configurações para esta função

nome da linha de tendência ou linha horizontal - para instalar o Indicador

nome do indicador - qual indicador você deseja instalar no gráfico

nome da linha horizontal ou de tendência do Indicador

-------------------------- o princípio do trabalho, deve ser o seguinte

----------------------- O indicador moverá a linha horizontal (azul) - se quebrar, abrirá em VENDA e removerá o indicador e definirá a linha amarela, que será pega por outro indicador e moverá a linha para o nível roxo do Indicador - depois, a linha horizontal amarela, definirá novamente o Indicador


pequenas correções no código, em//| Função para verificar e adicionar indicador ao gráfico |

#propriedade versão "1.005"

//+------------------------------------------------------------------+
//| Функция проверки и добавления индикатора на график               |
//+------------------------------------------------------------------+
bool AddIndicator()
  {
//--- выводимое сообщение
   string message;
//--- проверим на совпадение символ индикатора и символ графика
   if(_Symbol!=_Symbol)
     {
      message="Демонстрация использования функции Demo_ChartIndicatorAdd():";
      message=message+"\r\n";
      message=message+"Нельзя на график добавить индикатор, рассчитанный на другом символе.";
      message=message+"\r\n";
      message=message+"Укажите в свойствах эксперта символ графика - "+_Symbol+".";
      Alert(message);
      //--- досрочный выход, не будем добавлять индикатор на график
      return false;
     }
//--- проверим на совпадение таймфрейм индикатора и таймфрейм графика
   if(_Period!=_Period)
     {
      message="Нельзя на график добавить индикатор, рассчитанный на другом таймфрейме.";
      message=message+"\r\n";
      message=message+"Укажите в свойствах эксперта таймфрейм графика - "+EnumToString(_Period)+".";
      Alert(message);
      //--- досрочный выход, не будем добавлять индикатор на график
      return false;
     }
//--- все проверки прошли, символ и период индикатора соответствуют графику
   if(indicator_handle==INVALID_HANDLE)
     {
      Print(__FUNCTION__,"  Создаем индикатор");
      indicator_handle=iCustom(_Symbol,_Period,Inpshort_name);
      if(indicator_handle==INVALID_HANDLE)
        {
         Print("Не удалось создать индикатор. Код ошибки ",GetLastError());
        }
     }
//--- сбросим код ошибки
   ResetLastError();
//--- накладываем индикатор на график
   Print(__FUNCTION__,"  Добавляем индикатор на график");
   Print("Индикатор построен на ",_Symbol,"/",EnumToString(_Period));
//--- получим номер нового подокна, в которое добавим индикатор
   int subwindow=(int)ChartGetInteger(0,-1);
   PrintFormat("Добавляем индикатор на окно %d графика",subwindow);
   if(!ChartIndicatorAdd(0,subwindow,indicator_handle))
     {
      PrintFormat("Не удалось добавить индикатор на окно %d графика. Код ошибки  %d",
                  subwindow,GetLastError());
     }
//--- добавление индикатора на график прошло успешно
   return(true);
  }
//+------------------------------------------------------------------+
Arquivos anexados:
 
Alexsandr San:

pequenas correções no código, em//| Função de verificação e adição de indicador ao gráfico |

#propriedade versão "1.005"

ajustou ligeiramente o código

#propriedade versão "1.006

input string   t1="----- Trailing Line: 2   -----";              //
input string   InpObjUpNameG                = "POT";             // Obj: TOP (Horizontal Line)
input int      InpStep3                     = 0;                 // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommandG   = close_open_b;      // Obj:  command:
input string   InpObjDownNameG              = "REWOL";           // Obj: LOWER (Horizontal Line)
input int      InpStep4                     = 0;                 // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommandG    = close_open_s;      // Obj:  command:
input ushort   InpObjTrailingStopG          = 0;                 // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStepG          = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   t9="------ ChartIndicatorAdd -----";              //
input bool     InpChartInd                  = false;             // Avto Line Chart Indicators
input string   InpIndiL                     = "AVERAGE 0";       // Line name (ChartIndicatorAdd)
input int      InpStep5                     = 15;                // Obj: Шаг сетки, пунктов("0" -> false)
input string   InpIndi_name                 = "Indicator";       // INDICATOR_SHORTNAME

a partir de"AVERAGE 0"; irá definir a linha horizontal "POT"; e "REWOL"; à distância especificada =0;// Objeto: Passo da grade, pips("0" -> falso)

se definido = verdadeiro( = falso; // Avto Line Chart Indicators ) será repetido na distância dada da linha "AVERAGE 0";

Arquivos anexados:
 

Todo o dia e toda a noite - mas eu consegui o que queria Obrigado! Muito obrigado !!! VladimirKarputov

um sinal por tempo!!! Aqui está uma função

input string   t="-----  Parameters         -----";              //
input datetime InpMonday_1                  = D'1980.07.19 10:00:00'; // Monday time 1 (use only HH::MM) (00::00 -> off)
//+------------------------------------------------------------------+
long     m_monday_1= 0;

int OnInit()
  {
//---
   MqlDateTime STime;
//--- Monday
   TimeToStruct(InpMonday_1,STime);
   m_monday_1=STime.hour*60*60+STime.min*60;
//---
   return(INIT_SUCCEEDED);
  }

void OnTick()
  {
      TimeSession();

  }


//+------------------------------------------------------------------+
//| Search trading signals                                                                 |
//+------------------------------------------------------------------+
bool TimeSession()
  {
   bool res=false;
//---
   MqlDateTime STimeCurrent;
   TimeToStruct(TimeCurrent(),STimeCurrent);
   long time_current=STimeCurrent.hour*60*60+STimeCurrent.min*60+STimeCurrent.sec;
   if(m_monday_1==0)
      return(true);
//--- Monday time 1
   if(m_monday_1!=0 && (time_current>=m_monday_1 && time_current<m_monday_1+60))
     {
      datetime last_setup=0;
      MqlDateTime SLastSetup;
      TimeToStruct(last_setup,SLastSetup);
      long time_last_setup=SLastSetup.hour*60*60+SLastSetup.min*60+SLastSetup.sec;
      if(SLastSetup.day_of_week==1 && (time_last_setup>=m_monday_1 && time_last_setup<m_monday_1+60))
         return(true);
      if(1>0)
        {
         Sleep(59*1000);
         PlaySound("tick.wav");
        }
      res=true;
     }
//---
   return(true);
  }
//+------------------------------------------------------------------+
Vladimir Karputov
Vladimir Karputov
  • www.mql5.com
Люди. Граждане! Огромная просьба - заполняйте свой профиль на сайте и пользуйтесь стандартными программами - устанавливайте Skype. У Skype есть очень полезная функция - показ рабочего стола. В таком случае можно оперативно подсказать по возникшей проблеме. Помните - время - деньги! Древняя народная мудрость гласит: если хочешь помочь...
 
Alexsandr San:

ajustou um pouco o código

#propriedade versão "1.006

de"AVERAGE 0"; irá expor as linhas horizontais "POT"; e "REWOL"; a uma determinada distância = 0;// Objeto: Passo da grade, pips("0" -> falso)

se set =true( = false; // Avto Line Chart Indicators ) será repetido à distância set da linha "AVERAGE 0 " ;

#propriedade versão "1.007
Adicionado - por Tempo, definir Indicador, linhas horizontais, que são definidas a que distância, a partir do preço.

bem como por Tempo, fechar todas as posições e apagar o Expert Advisor e mudar os gráficos ou simplesmente, sem apagar nenhuma posição em aberto, apagar o Expert Advisor e mudar o modelo de gráfico .

Aqui estão seus ajustes

//+------------------------------------------------------------------+
input string   t="-----  Parameters         -----";              //
input string   Template                     = "ADX";             // Имя шаблона(without '.tpl')
input bool     Inpwithout                   = false;             // Сменить только шаблон (true)
input datetime InpMonday_2                  = D'1970.01.01';     // Dell (00::00 -> off)
input double   TargetProfit                 = 999999.99;         // Цель Баланса(Ваш Баланс + сумма)
input uint     maxLimits                    = 1;                 // Кол-во Позиции Открыть в одну сторону
input double   InpLots                      = 0.01;              // Lots
input int      InpTakeProfit                = 90;                // Take Profit ("0"-No. 5<100)
input string   t0="----- Trailing Line: 1   -----";              //
input string   InpObjUpName                 = "ZTOP";            // Obj: TOP (Horizontal Line)
input int      InpStep1                     = 25;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommand    = open_sell;         // Obj:  command:
input string   InpObjDownName               = "ZLOWER";          // Obj: LOWER (Horizontal Line)
input int      InpStep2                     = 25;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommand     = open_buy;          // Obj:  command:
input ushort   InpObjTrailingStop           = 0;                 // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStep           = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   t2="----- Indicators: SELL   -----";              //
input string   short_name                   = "LeMan_BrainTrend1Sig";   // Name Indicators "SELL"
input bool     InpIndicators                = false;             // Indicators: Start (true)
input ENUM_TRADE_COMMAND InpTradeCommandY   = open_sell;         // Trade command: (BuyBuffer Indicators)
input ENUM_TRADE_COMMAND InpTradeCommandU   = close_sells;       // Trade command: (SellBuffer Indicators)
input string   t3="----- Indicators: BUY    -----";              //
input string   short_name1                  = "LeMan_BrainTrend1Sig";   // Name Indicators "BUY"
input bool     InpIndicators1               = false;             // Indicators: Start (true)
input ENUM_TRADE_COMMAND InpTradeCommandY1  = close_buys;        // Trade command: (BuyBuffer Indicators)
input ENUM_TRADE_COMMAND InpTradeCommandU1  = open_buy;          // Trade command: (SellBuffer Indicators)
input string   t4="----- Button:            -----";              //
input ENUM_TRADE_COMMAND InpTradeCommandBut = open_buy;          // Obj(BUY):  command:Button: BUY
input ENUM_TRADE_COMMAND InTradeCommandBut  = open_sell;         // Obj(SELL):  command:Button: SELL
input int      TrailingStop_STOP_LEVEL      = 36;                // Button: Trailing Stop LEVEL
input string   t5="----- Line name: 1       -----";              //
input string   InpNameR                     = "LineR";           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandR   = open_buy;          // Trade command:
input string   t6="----- Line name: 2       -----";              //
input string   InpNameS                     = "LineS";           // Line name (Horizontal Line or Trend Line)
input ENUM_TRADE_COMMAND InpTradeCommandS   = open_sell;         // Trade command:
input string   t7="----- Revers Buy><Sell   -----";              //
input bool     ObjRevers                    = false;             //  Revers
input string   t8="------ Indicator Delete  -----";              //
input string   Inpshort_name_1              = "Indicator 2";     // INDICATOR_SHORTNAME 2
input bool     Inpres                       = false;             // Delete All Indicators
input string   t1="----- Trailing Line: 2   -----";              //
input string   InpObjUpNameG                = "POT";             // Obj: TOP (Horizontal Line)
input int      InpStep3                     = 20;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InpTradeCommandG   = close_open_b;      // Obj:  command:
input string   InpObjDownNameG              = "REWOL";           // Obj: LOWER (Horizontal Line)
input int      InpStep4                     = 20;                // Obj: Шаг сетки, пунктов("0" -> false)
input ENUM_TRADE_COMMAND InTradeCommandG    = close_open_s;      // Obj:  command:
input ushort   InpObjTrailingStopG          = 0;                 // Obj: Trailing Stop (distance from price to object, in pips)
input ushort   InpObjTrailingStepG          = 5;                 // Obj: Trailing Step, in pips (1.00045-1.00055=1 pips)
input string   t9="------ ChartIndicatorAdd -----";              //
input bool     InpChartInd                  = false;             // Avto Line Chart Indicators
input string   InpIndiL                     = "AVERAGE 0";       // Line name (ChartIndicatorAdd)
input int      InpStep5                     = 15;                // Obj: Шаг сетки, пунктов("0" -> false)
input string   InpIndi_name                 = "Indicator";       // INDICATOR_SHORTNAME
input datetime InpMonday_1                  = D'1970.01.01';     // Indicators(use only HH::MM)(00::00->off)
//+------------------------------------------------------------------+
Arquivos anexados:
 

O indicador dá Alerta - a partir da linha Horizontal azul, desenhamos um em cima, outro em baixo e à medida que a linha azul se cruza, ele aciona o Alerta e apaga a linha

- Vou acrescentar, esta função emUtility_Command.mq5225 kb

Foto por

Arquivos anexados:
macd_Line.mq5  21 kb
 

Não é fácil fazer com que as linhas horizontais funcionem na janela do Indicador

mas eu meio que resolvi algo. Aqui está um rascunho. Da linha nula da macd (VENDA quebra de linha inferior COMPRAR linha superior)

Foto por

Instantâneo2

-------------------------

Esboço de especialista e indicador

Arquivos anexados:
 
Alexsandr San:

Não é fácil conseguir que as linhas horizontais funcionem na Janela do Indicador

mas eu meio que resolvi algo. Aqui está um rascunho. Da linha zero da macd (VENDA quebra de linha inferior COMPRAR linha superior)

-------------------------

um rascunho de Perito e indicador

Na verdade, o Expert Advisor trabalha na Janela de Indicadores - se LOW é uma linha horizontal, entre as linhas COMPRAR e VENDER não abre uma posição, mas se move mais alto do que COMPRAR, abre uma posição COMPRAR.

inversamente, abaixo dalinha SELL abre uma posição devenda

AUDCADM1

 
Alexsandr San:

O indicador dá Alerta - a partir da linha Horizontal azul, desenhamos um em cima, outro em baixo e à medida que a linha azul se cruza, ele aciona o Alerta e apaga a linha

- Vou acrescentar, esta função emUtility_Command.mq5225 kb

Eu acrescentei esta função - é muito simples, mas eu só descobri como implementá-la

#propriedade versão "1.008

AUDCADM1V 1

AUDCADM1B 2

Foto por 3


Eu anexarei um indicador para esta função

Arquivos anexados:
 

Sim! Você também deve adicionar isto ao Utilitáriohttps://www.mql5.com/ru/code/23939


OBJ_HLINE follows price
OBJ_HLINE follows price
  • www.mql5.com
GannZIGZAG_Fibo_Grand_xN_Din Зигзаг Ганна с графическим объектом "Уровни Фибоначчи", построенными на двух, последних вершинах с расширенными настройками для отображения фибо-уровней. XKPrmSt_NRTR_HTF
Razão: