Comment j'ai assemblé mon conseiller par essais et erreurs - page 49

 

Indicateur - Obj LeM Brain - peut être adapté à ExpertUtility Command.mq5

Photo par

Vous avez également besoin de 2 autres indicateurs - LeMan_BrainTrend1Sig - et - LeManTrend Indicator - sans eux, il ne fonctionnera pas- Obj LeM Brain -.

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

augmenter la distance des lignes horizontales, à partir du point

Instantané2

 
Alexsandr San:

Nous devons ajouter une autre fonction - lorsque la ligne horizontale est déclenchée, ce qui est présent dans de nombreux indicateurs, pour supprimer non seulement la ligne mais aussi l'indicateur lui-même, qui dessine la ligne horizontale.

 
Alexsandr San:

Une autre fonction à ajouter - lorsque la ligne horizontale est déclenchée, ce qui est présent dans de nombreux indicateurs, pour supprimer non seulement la ligne mais aussi l'indicateur lui-même qui dessine la ligne horizontale.

Fonction ajoutée

input string   t8="------ Indicator Delete ------";              //
input string   Inpshort_name                = "Obj LeM Brain";   // INDICATOR_SHORTNAME 1
input string   Inpshort_name0               = "Indicator 2";     // INDICATOR_SHORTNAME 2
input bool     Inpres                       = false;             // Delete All Indicators
//---
#property version     "1.002"
Dossiers :
 
Alexsandr San:

Indicateur - Obj LeM Brain - peut être adapté à ExpertUtility Command.mq5

pour un Indicateur vous avez besoin de 2 autres Indicateurs - LeMan_BrainTrend1Sig - et - LeManTrend Indicator - sans eux ne fonctionnera pas- Obj LeM Brain -

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

augmenter la distance des lignes horizontales, à partir du point


Turns out and minus , changes Lignes horizontales vers l'intérieur.

Photo par

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

Cet indicateur n'a pas besoin d'être écrit dans un Expert Advisor - seules les lignes horizontales sont nécessaires à cet indicateur. Il faut écrire dans Expert Advisor pour supprimer l'indicateur

vous n'êtes pas obligé de l'utiliser -

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)

et ici - pour supprimer l'indicateur - afin que les lignes horizontales de l'indicateur ne répètent pas les commandes

input string   t8="------ Indicator Delete ------";              //
input string   Inpshort_name                = "Obj LeM Brain";   // INDICATOR_SHORTNAME 1
input string   Inpshort_name0               = "Indicator 2";     // INDICATOR_SHORTNAME 2
input bool     Inpres                       = false;             // Delete All Indicators
 

une fonction de plus à ajouter à l'Expert, du signal à la mise en place de l'Indicateur sur le Graphique

//+------------------------------------------------------------------+
//|                                         AddChartIndicatorAdd.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property script_show_inputs
//---
input string Inpshort_name  = "Obj LeM Brain"; // INDICATOR_SHORTNAME
input string Inpshort_name0 = "Examples/MACD"; // INDICATOR_SHORTNAME
//---
int indicator_handle=INVALID_HANDLE;
int indicator_handle0=INVALID_HANDLE;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   AddIndicator();
   AddIndicator0();
  }
//+------------------------------------------------------------------+
//| Функция проверки и добавления индикатора на график               |
//+------------------------------------------------------------------+
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__,"  Создаем индикатор MACD");
      indicator_handle=iCustom(_Symbol,_Period,Inpshort_name);
      if(indicator_handle==INVALID_HANDLE)
        {
         Print("Не удалось создать индикатор MACD. Код ошибки ",GetLastError());
        }
     }
//--- сбросим код ошибки
   ResetLastError();
//--- накладываем индикатор на график
   Print(__FUNCTION__,"  Добавляем индикатор MACD на график");
   Print("MACD построен на ",_Symbol,"/",EnumToString(_Period));
//--- получим номер нового подокна, в которое добавим индикатор MACD
   int subwindow=(int)ChartGetInteger(0,0);
   PrintFormat("Добавляем индикатор MACD на окно %d графика",subwindow);
   if(!ChartIndicatorAdd(0,subwindow,indicator_handle))
     {
      PrintFormat("Не удалось добавить индикатор MACD на окно %d графика. Код ошибки  %d",
                  subwindow,GetLastError());
     }
//--- добавление индикатора на график прошло успешно
   return(true);
  }
//+------------------------------------------------------------------+
//| Функция проверки и добавления индикатора на график               |
//+------------------------------------------------------------------+
bool AddIndicator0()
  {
//--- выводимое сообщение
   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_handle0==INVALID_HANDLE)
     {
      Print(__FUNCTION__,"  Создаем индикатор MACD");
      indicator_handle0=iCustom(_Symbol,_Period,Inpshort_name0);
      if(indicator_handle0==INVALID_HANDLE)
        {
         Print("Не удалось создать индикатор MACD. Код ошибки ",GetLastError());
        }
     }
//--- сбросим код ошибки
   ResetLastError();
//--- накладываем индикатор на график
   Print(__FUNCTION__,"  Добавляем индикатор MACD на график");
   Print("MACD построен на ",_Symbol,"/",EnumToString(_Period));
//--- получим номер нового подокна, в которое добавим индикатор MACD
   int subwindow=(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL);
   PrintFormat("Добавляем индикатор MACD на окно %d графика",subwindow);
   if(!ChartIndicatorAdd(0,subwindow,indicator_handle0))
     {
      PrintFormat("Не удалось добавить индикатор MACD на окно %d графика. Код ошибки  %d",
                  subwindow,GetLastError());
     }
//--- добавление индикатора на график прошло успешно
   return(true);
  }
//+------------------------------------------------------------------+

Shot4

Dossiers :
 

Je n'arrive pas à trouver ce dont j'ai besoin dans cette fonction.

Je pense avoir trouvé une solution, il suffit d'écrire dans le code des actions comme sur l'image.

Photo par

 
Alexsandr San:

Je n'arrive pas à trouver ce dont j'ai besoin dans cette fonction.

Je pense avoir trouvé une solution, il suffit d'écrire dans le code des actions comme sur l'image.

J'ai ajouté cette fonctionnalité à la commande Utilitaire ("Utility Command") #property version "1.004"

en bas, les paramètres de cette fonction

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                 = "Obj LeM Brain";   // INDICATOR_SHORTNAME

nom de la ligne de tendance ou de la ligne horizontale - pour définir l'indicateur

input string   InpIndiL                     = "AVERAGE 0";       // Line name (ChartIndicatorAdd)

nom de l'indicateur - l'indicateur que vous voulez installer sur le graphique

input string   InpIndi_name                 = "Obj LeM Brain";   // INDICATOR_SHORTNAME

nom de la ligne horizontale ou de tendance de l'Indicateur

input string   InpObjUpNameG                = "POT";             // Obj: TOP (Horizontal Line)


input string   InpObjDownNameG              = "REWOL";           // Obj: LOWER (Horizontal Line)

Photo par

-------------------------- le principe de fonctionnement devrait être

GBPUSDM2

----------------------- L'indicateur a déplacé la ligne horizontale (bleue) - s'il la franchit, il s'ouvrira en VENTE et supprimera l'indicateur et fixera la ligne jaune, qui sera reprise par un autre indicateur et déplacera la ligne jusqu'au niveau violet de l'indicateur - après, la ligne horizontale jaune, fixera à nouveau l'indicateur.

GBPUSDM2h

Dossiers :
 
Vous le faites par "jauge" et vous le faites par "jauge".

"Doigts dans le ciel", c'est du temps dans le vent.
 
Alexsandr San:

Quand je vide un dépôt, je commence à piquer.

Vous perdez donc votre dépôt avant même de commencer à négocier.
C'est pourquoi on "poke" du début à la fin.
 
Alexsandr San:

Je pensais que tu allais dire quelque chose d'intelligent.

Les choses intelligentes sont dites lorsqu'il y a un besoin immédiat.
Maintenant, il y avait un besoin pour cela. Mais apparemment, ça n'a rien donné.
Raison: