We need to add another function - when the Horizontal line is triggered, which is present in many Indicators, to delete not only the line but also the Indicator itself, which draws the Horizontal line
Another function to be added - when the Horizontal line is triggered, which is present in many Indicators, to delete not only the line but also the Indicator itself which draws the Horizontal line
This indicator does not need to be written in an Expert Advisor - only Horizontal Lines are needed from this indicator. It should be written in Expert Advisor to delete indicator
one more function to be added to the Expert, from the signal to set the Indicator on the Chart
//+------------------------------------------------------------------+//| 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//---inputstring Inpshort_name = "Obj LeM Brain"; // INDICATOR_SHORTNAMEinputstring Inpshort_name0 = "Examples/MACD"; // INDICATOR_SHORTNAME//---int indicator_handle=INVALID_HANDLE;
int indicator_handle0=INVALID_HANDLE;
//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
//---
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);
//--- досрочный выход, не будем добавлять индикатор на графикreturnfalse;
}
//--- проверим на совпадение таймфрейм индикатора и таймфрейм графикаif(_Period!=_Period)
{
message="Нельзя на график добавить индикатор, рассчитанный на другом таймфрейме.";
message=message+"\r\n";
message=message+"Укажите в свойствах эксперта таймфрейм графика - "+EnumToString(_Period)+".";
Alert(message);
//--- досрочный выход, не будем добавлять индикатор на графикreturnfalse;
}
//--- все проверки прошли, символ и период индикатора соответствуют графику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));
//--- получим номер нового подокна, в которое добавим индикатор MACDint 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);
//--- досрочный выход, не будем добавлять индикатор на графикreturnfalse;
}
//--- проверим на совпадение таймфрейм индикатора и таймфрейм графикаif(_Period!=_Period)
{
message="Нельзя на график добавить индикатор, рассчитанный на другом таймфрейме.";
message=message+"\r\n";
message=message+"Укажите в свойствах эксперта таймфрейм графика - "+EnumToString(_Period)+".";
Alert(message);
//--- досрочный выход, не будем добавлять индикатор на графикreturnfalse;
}
//--- все проверки прошли, символ и период индикатора соответствуют графику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));
//--- получим номер нового подокна, в которое добавим индикатор MACDint 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);
}
//+------------------------------------------------------------------+
-------------------------- the working principle should be
----------------------- The indicator will move the horizontal line (blue) - if it breaks through, it will open in SELL and remove the indicator and set a yellow line, which will be picked up by another indicator and move the line to the purple level of the indicator - after, the horizontal yellow line, will set the indicator again
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Indicator - Obj LeM Brain - can be adapted to ExpertUtility Command.mq5
for an Indicator you need 2 more Indicators - LeMan_BrainTrend1Sig - and - LeManTrend Indicator - without them will not work- Obj LeM Brain -
-----------------------------------------------------------
increase the distance of Horizontal lines, from the point
We need to add another function - when the Horizontal line is triggered, which is present in many Indicators, to delete not only the line but also the Indicator itself, which draws the Horizontal line
Another function to be added - when the Horizontal line is triggered, which is present in many Indicators, to delete not only the line but also the Indicator itself which draws the Horizontal line
Added function
Indicator - Obj LeM Brain - can be adapted to ExpertUtility Command.mq5
for an Indicator you need 2 more Indicators - LeMan_BrainTrend1Sig - and - LeManTrend Indicator - without them will not work- Obj LeM Brain -
-----------------------------------------------------------
increase the distance of horizontal lines, from the point
Turns out and minus , changes Horizontal lines inwards
---------------------------------------------------------
This indicator does not need to be written in an Expert Advisor - only Horizontal Lines are needed from this indicator. It should be written in Expert Advisor to delete indicator
you do not have to use it -
and here - to delete indicator - so that indicator horizontal lines won't repeat commands
one more function to be added to the Expert, from the signal to set the Indicator on the Chart
I can't figure out what I need from this function.
I think I've found an option, I just need to write in the code, such actions, as on the picture
I can't figure out what I need from this function.
I think I've found an option, I just need to write in the code, such actions, as on the picture
I added this feature to the Utility Command ("Utility Command") #property version "1.004"
at the bottom, settings for this function
name of trend line or horizontal line - to set indicator
indicator name - which indicator you want to install on the chart
name of horizontal or trend line of the Indicator
-------------------------- the working principle should be
----------------------- The indicator will move the horizontal line (blue) - if it breaks through, it will open in SELL and remove the indicator and set a yellow line, which will be picked up by another indicator and move the line to the purple level of the indicator - after, the horizontal yellow line, will set the indicator again
When I drain a deposit, I start poking.
I thought you were going to say something clever.