Come ho assemblato il mio consulente per tentativi ed errori - pagina 50

 
Alexsandr San:

Aggiunta questa caratteristica all'utilità ("Comando utilità") #proprietà versione "1.004"

in basso, le impostazioni per questa funzione

nome della linea di tendenza o linea orizzontale - per installare l'indicatore

nome dell'indicatore - quale indicatore si vuole installare sul grafico

nome della linea orizzontale o di tendenza dell'indicatore

-------------------------- il principio del lavoro, dovrebbe essere il seguente

----------------------- L'indicatore sposterà la linea orizzontale (blu) - se la sfonda, si aprirà in SELL e rimuoverà l'indicatore e imposterà una linea gialla, che sarà raccolta da un altro indicatore e sposterà la linea al livello viola dell'indicatore - dopo, il giallo orizzontale, di nuovo imposterà l'indicatore


La funzione funziona perfettamente - l'utilità, molto, non male si è rivelata.

Tuttavia, è necessario aggiungere a questa funzione, un'altra impostazione, che imposterà l'indicatore, attraverso il numero di punti dalla posizione aperta

Foto di

 
Alexsandr San:

Aggiunta questa caratteristica all'utilità ("Comando utilità") #proprietà versione "1.004"

in basso, le impostazioni per questa funzione

nome della linea di tendenza o linea orizzontale - per installare l'indicatore

nome dell'indicatore - quale indicatore si vuole installare sul grafico

nome della linea orizzontale o di tendenza dell'indicatore

-------------------------- il principio del lavoro, dovrebbe essere il seguente

----------------------- L'indicatore muoverà la linea orizzontale (blu) - se la sfonda, si aprirà in SELL e rimuoverà l'indicatore e imposterà la linea gialla, che sarà raccolta da un altro indicatore e sposterà la linea al livello dell'indicatore viola - dopo, la linea orizzontale gialla, imposterà nuovamente l'indicatore


piccole correzioni nel codice, in//| Funzione per controllare e aggiungere l'indicatore al grafico

#proprietà versione "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);
  }
//+------------------------------------------------------------------+
File:
 
Alexsandr San:

piccole correzioni nel codice, in//| Funzione di controllo e aggiunta dell'indicatore al grafico

#proprietà versione "1.005"

leggermente modificato il codice

#proprietà versione "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

da"AVERAGE 0"; imposterà la linea orizzontale "POT"; e "REWOL"; alla distanza specificata =0;// Obj: Passo della griglia, pips("0" -> false)

se set =true( = false; // Avto Line Chart Indicators ) sarà ripetuto alla distanza data dalla linea "AVERAGE 0";

File:
 

Tutto il giorno e tutta la notte - ma ho ottenuto quello che volevo Grazie! Grazie mille!!! VladimirKarputov

un segnale per volta!!! Ecco una funzione

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:

ha modificato un po' il codice

#proprietà versione "1.006"

da"AVERAGE 0"; esporrà le linee orizzontali "POT"; e "REWOL"; a una data distanza = 0;// Obj: Grid Step, pips("0" -> false)

se set =true( = false; // Avto Line Chart Indicators ) sarà ripetuto alla distanza impostata dalla linea "AVERAGE 0" ;

#proprietà versione "1.007"
Aggiunto - da tempo, impostare indicatore, linee orizzontali, che sono impostati a quale distanza, dal prezzo.

così come per Time, chiudere tutte le posizioni e cancellare l'Expert Advisor e cambiare i grafici o semplicemente, senza cancellare nessuna posizione aperta, cancellare l'Expert Advisor e cambiare il Chart Template.

Ecco le sue impostazioni

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

L'indicatore dà Alert - dalla linea blu orizzontale, ne disegniamo una in alto, un'altra in basso e come la linea blu attraversa, attiva Alert e cancella la linea

- Aggiungerò questa funzione inUtility_Command.mq5225 kb

Foto di

File:
macd_Line.mq5  21 kb
 

Non è facile far funzionare le linee orizzontali nella finestra Indicatore

ma ho trovato una specie di soluzione. Ecco una bozza. Da macd linea nulla (SELL linea inferiore rompere BUY linea superiore)

Foto di

Istantanea2

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

Progetto di esperti e indicatori

File:
 
Alexsandr San:

Non è facile far funzionare le linee orizzontali nella finestra dell'indicatore

ma ho trovato una specie di soluzione. Ecco una bozza. Dalla linea zero di macd (linea inferiore di vendita rompe la linea superiore di acquisto)

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

una bozza di esperto e indicatore

Infatti, l'Expert Advisor lavora nella finestra dell'indicatore - se LOW è una linea orizzontale, tra le linee BUY e SELL non apre una posizione, ma appena si muove più in alto del BUY apre una

al contrario, sotto lalinea SELL apre una posizione divendita

AUDCADM1

 
Alexsandr San:

L'indicatore dà Alert - dalla linea blu orizzontale, ne disegniamo una in alto, un'altra in basso e quando la linea blu si incrocia, scatta Alert e cancella la linea

- Aggiungerò questa funzione inUtility_Command.mq5225 kb

Ho aggiunto questa funzione - è molto semplice, ma ho solo scoperto come implementarla

#proprietà versione "1.008"

AUDCADM1V 1

AUDCADM1B 2

Foto di 3


Allego un indicatore per questa funzione

File:
 

Sì! Dovresti aggiungere anche questo all'Utilitàhttps://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
Motivazione: