Cómo armo mi asesor por ensayo y error - página 50

 
Alexsandr San:

Se ha añadido esta función a la Utilidad ("Comando de la Utilidad") #versión de la propiedad "1.004"

en la parte inferior, los ajustes para esta función

nombre de la línea de tendencia o línea horizontal - para instalar el indicador

nombre del indicador - qué indicador quiere instalar en el gráfico

nombre de la línea horizontal o de tendencia del Indicador

-------------------------- el principio del trabajo, debería ser el siguiente

----------------------- El indicador moverá la línea horizontal (azul) - si se rompe a través de, se abrirá en SELL y eliminar el indicador y establecer una línea amarilla, que será recogido por otro indicador y se moverá la línea al nivel de púrpura del indicador - después de la, amarillo horizontal, de nuevo se establecerá el indicador


La función funciona perfectamente - la Utilidad, muy, nada mal resultó .

Sin embargo, es necesario añadir a esta función, más ajuste, que fijará el Indicador, a través del número de puntos de la posición abierta

Foto de

 
Alexsandr San:

Se ha añadido esta función a la Utilidad ("Comando de la Utilidad") #versión de la propiedad "1.004"

en la parte inferior, los ajustes para esta función

nombre de la línea de tendencia o línea horizontal - para instalar el indicador

nombre del indicador - qué indicador quiere instalar en el gráfico

nombre de la línea horizontal o de tendencia del Indicador

-------------------------- el principio del trabajo, debería ser el siguiente

----------------------- El indicador moverá la línea horizontal (azul) - si se rompe a través de, se abrirá en la venta y eliminar el indicador y establecer la línea amarilla, que será recogido por otro indicador y mover la línea al nivel de púrpura del Indicador - después de, la línea amarilla horizontal, de nuevo establecer el Indicador


correcciones menores en el código, en//| Función para comprobar y añadir el indicador al gráfico |

#versión de la propiedad "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);
  }
//+------------------------------------------------------------------+
Archivos adjuntos:
 
Alexsandr San:

correcciones menores en el código, en//| Función para comprobar y añadir el indicador al gráfico |

#versión de la propiedad "1.005"

ajustado ligeramente el código

#versión de la propiedad "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

de"AVERAGE 0"; establecerá la línea horizontal "POT"; y "REWOL"; a la distancia especificada =0;// Obj: Paso de rejilla, pips("0" -> false)

si set =true( = false; // Indicadores del gráfico de líneas Avto ) se repetirá a la distancia dada de la línea "AVERAGE 0";

Archivos adjuntos:
 

Todo el día y toda la noche - pero conseguí lo que quería ¡Gracias! Muchas gracias!!! VladimirKarputov

¡¡¡una señal por tiempo !!! Esta es una función

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:

ajustado el código un poco

#versión de la propiedad "1.006"

de"AVERAGE 0"; expondrá las líneas horizontales "POT"; y "REWOL"; a una distancia dada = 0;// Obj: Grid Step, pips("0" -> false)

si set =true( = false; // Indicadores de Gráfico de Líneas Avto ) se repetirá a la distancia establecida de la línea "AVERAGE 0" ;

#versión de la propiedad "1.007"
Añadido - por Tiempo, establecer Indicador, Líneas horizontales, que se establecen a qué distancia, desde el precio.

así como para el Tiempo, cerrar todas las posiciones y borrar el Asesor Experto y cambiar los gráficos o simplemente, sin borrar ninguna posición abierta, borrar el Asesor Experto y cambiar la Plantilla de Gráficos .

Esta es su configuración

//+------------------------------------------------------------------+
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)
//+------------------------------------------------------------------+
Archivos adjuntos:
 

El indicador da Alerta - de la línea azul Horizontal, dibujamos una en la parte superior, otra en la parte inferior y al cruzar la línea azul, activa la Alerta y borra la línea

- Voy a añadir, esta función enUtility_Command.mq5225 kb

Foto de

Archivos adjuntos:
macd_Line.mq5  21 kb
 

No es fácil hacer que las líneas horizontales funcionen en la ventana del indicador

pero he resuelto algo. Aquí hay un borrador. Desde la línea nula de macd (la línea inferior de VENTA rompe la línea superior de COMPRA)

Foto de

Instantánea2

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

Borrador de expertos e indicadores

Archivos adjuntos:
 
Alexsandr San:

No es fácil conseguir que las líneas horizontales funcionen en la ventana del indicador

pero he resuelto algo. Aquí hay un borrador. Desde la línea cero de macd (la línea inferior de VENTA rompe la línea superior de COMPRA)

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

un proyecto de Experto e indicador

De hecho, el Asesor Experto trabaja en la Ventana del Indicador - si LOW es una línea horizontal, entre las líneas BUY y SELL no abre una posición, pero se mueve más alto que BUY, abre una posición BUY.

por el contrario, por debajo de lalínea de VENTA se abre una posiciónde venta

AUDCADM1

 
Alexsandr San:

El indicador da Alerta - de la línea azul Horizontal, dibujamos una en la parte superior, otra en la parte inferior y al cruzar la línea azul, activa la Alerta y borra la línea

- Voy a añadir, esta función enUtility_Command.mq5225 kb

He añadido esta función - es muy simple, pero sólo he descubierto cómo implementarla

#versión de la propiedad "1.008"

AUDCADM1V 1

AUDCADM1B 2

Foto de 3


Adjunto un indicador para esta función

Archivos adjuntos:
 

Sí, también debería añadir esto a lapágina web de la empresahttps://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