"Removing an indicator from a chart does not mean that the calculation part of the indicator will also be removed from the terminal memory. To release the indicator handle, use IndicatorRelease() function."
Yes, Vladimir, I've already done that and written about it before, but the result is still the same.
I have been solving this problem for more than an hour. I wanted to create and display ZigZagColor indicator on the chart at the Expert Advisor startup. It was done in int OnInit:
But the indicator is not removed. I have sorted everything out. I have cleaned the handle and applied the delete function. I wonder what is the reason why it is not uninstalling.
Remove the indicator from the chart with the function
ChartIndicatorDelete(
long chart_id, // chart ID
int sub_window // number of the subwindow
const string indicator_shortname // short indicator name
);
Thanks, Alexey, I will try it with a clear head tomorrow, I'm already confused by the information I've got. As they say, I'll sleep better in the morning!
I now have another thing that puzzled and surprised me a lot. I tried to clear the chart with the script developed by Vladimir Karputov, but this script deleted absolutely everything except for the custom indicator ZigzagColor! Tried to remove a simple ZigZag with the same script, it doesn't remove either! It's a mystery...
Thanks, Alexey, tomorrow I'll try it with a clear head, as I'm already in a mess of information. As the saying goes - wiser in the morning!
Now there is another thing that puzzled me a lot and surprised me. I tried to clear the chart with the script developed by Vladimir Karputov, but this script deleted absolutely everything except for the custom indicator ZigzagColor! Tried to remove a simple ZigZag with the same script, it doesn't remove either! It's a mystery...
Regards, Vladimir.
Try this script
#property copyright"Copyright 2020, MetaQuotes Software Corp."#property link"https://www.mql5.com"#property version"1.00"//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
//---int window=ChartWindowFind(0,"ZigzagColor");
bool res=ChartIndicatorDelete(0,window,"ZigzagColor");
//--- проанализируем результат вызова ChartIndicatorDelete()if(!res)
{
PrintFormat("Не удалось удалить индикатор ZigzagColor с окна #%d. Код ошибки %d",
window,GetLastError());
}
}
short name ZigzagColor - and this is the default, if you set it differently you need to write those digits
and that is how it should be spelled
or you can change the indicator itself - give a simpler name
//--- name for DataWindow and indicator subwindow labelIndicatorSetString(INDICATOR_SHORTNAME,"ZigZag("+(string)InpDepth+","+(string)InpDeviation+","+(string)InpBackstep+")");
PlotIndexSetString(0,PLOT_LABEL,"ZigzagColor");
//--- set an empty value
for example
//--- name for DataWindow and indicator subwindow labelIndicatorSetString(INDICATOR_SHORTNAME,"ZigZag");
PlotIndexSetString(0,PLOT_LABEL,"ZigzagColor");
//--- set an empty value
-----------------------------------------------
i already showed you the script - if this script is attached to a chart and you don't give an indicator name, it will work without deleting any indicator - but it will write in the Expert Advisor window which indicators are available
https://c.mql5.com/3/332/IndicatorDelete.mq5
This is what I have
CS 003:41:36.549 IndicatorDelete (XAUUSD,M30) EWO(5,35)
DF 003:41:36.604 IndicatorDelete (XAUUSD,M30) ZigZag(12,5,3)
KR 003:41:36.626 IndicatorDelete (XAUUSD,M30) LeMan_BrainTrend1Sig
FE 003:41:36.646 IndicatorDelete (XAUUSD,M30) Hline VSC
RN 003:41:36.666 IndicatorDelete (XAUUSD,M30) Pivot Lines TimeZone
KG 003:41:36.686 IndicatorDelete (XAUUSD,M30) Line through two fractals
DL 003:41:36.706 IndicatorDelete (XAUUSD,M30) sanbox
Коды ошибок и предупреждений - Константы, перечисления и структуры - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
or you can also change the indicator itself by giving it a simpler name
like this
-----------------------------------------------
I have already downloaded the script - if this script is attached to a chart and you do not give an indicator name it will work without deleting any Indicator - but it will write in the Expert Advisor window which Indictors are present
https://c.mql5.com/3/332/IndicatorDelete.mq5
This is what I have!
Hello! I have implemented your script. Two indicators appeared in the Experts tab : Volumes and ZigZag (80,20,0). It is indeed so, only the ZigZag indicator is written without Color for some reason.
Aleksey, applied your script. I got error code 4115.
Regards, Vladimir.
I have to be more careful.
boolChartIndicatorDelete(
long chart_id, // идентификатор графика int sub_window // номер подокна conststringindicator_shortname // короткое имя индикатора
);
Indicator name and indicator short name often do not coincide.
Hello! I have applied your script. Two indicators appeared in the Experts tab: Volumes and ZigZag (80,20,0). It is indeed so, only the ZigZag indicator is written without Color for some reason.
Sincerely, Vladimir.
So, you have to write it like this - ZigZag (80,20,0).
It will definitely be deleted in this case.
-----------------
but withoutColor
because this is how it is written in the indicator
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.
I usually clear the handle and the calculation part in OnDeinit and everything is removed. The object is not an indicator.
https://www.mql5.com/ru/docs/chart_operations/chartindicatordelete
"Removing an indicator from a chart does not mean that the calculation part of the indicator will also be removed from the terminal memory. To release the indicator handle, use IndicatorRelease() function."
Yes, Vladimir, I've already done that and written about it before, but the result is still the same.
Regards, Vladimir.
Forum on trading, automated trading systems and strategy testing
New trading robot
MrBrooklin, 2020.09.28 10:38
I have been solving this problem for more than an hour. I wanted to create and display ZigZagColor indicator on the chart at the Expert Advisor startup. It was done in int OnInit:
The indicator was created and displayed. Now I need the indicator to be deleted after the Expert Advisor is removed. I am writing it:
But the indicator is not removed. I have sorted everything out. I have cleaned the handle and applied the delete function. I wonder what is the reason why it is not uninstalling.
Regards, Vladimir.
Remove the indicator from the chart with the function
ChartIndicatorDelete(
long chart_id, // chart ID
int sub_window // number of the subwindow
const string indicator_shortname // short indicator name
);
Thanks, Alexey, I will try it with a clear head tomorrow, I'm already confused by the information I've got. As they say, I'll sleep better in the morning!
I now have another thing that puzzled and surprised me a lot. I tried to clear the chart with the script developed by Vladimir Karputov, but this script deleted absolutely everything except for the custom indicator ZigzagColor! Tried to remove a simple ZigZag with the same script, it doesn't remove either! It's a mystery...
Regards, Vladimir.
Thanks, Alexey, tomorrow I'll try it with a clear head, as I'm already in a mess of information. As the saying goes - wiser in the morning!
Now there is another thing that puzzled me a lot and surprised me. I tried to clear the chart with the script developed by Vladimir Karputov, but this script deleted absolutely everything except for the custom indicator ZigzagColor! Tried to remove a simple ZigZag with the same script, it doesn't remove either! It's a mystery...
Regards, Vladimir.
Try this script
short name ZigzagColor - and this is the default, if you set it differently you need to write those digits
and that's exactly what you need to put in
short name ZigzagColor - and this is the default, if you set it differently you need to write those digits
and that is how it should be spelled
or you can change the indicator itself - give a simpler name
for example
-----------------------------------------------
i already showed you the script - if this script is attached to a chart and you don't give an indicator name, it will work without deleting any indicator - but it will write in the Expert Advisor window which indicators are available
https://c.mql5.com/3/332/IndicatorDelete.mq5
This is what I have
Try this script
Good day everyone!
Aleksey, I have applied your script. I got error code 4115. I found what it means in the handbook:
ERR_CHART_INDICATOR_CANNOT_DEL
4115
Error when deleting the indicator from the chart
Regards, Vladimir.
or you can also change the indicator itself by giving it a simpler name
like this
-----------------------------------------------
I have already downloaded the script - if this script is attached to a chart and you do not give an indicator name it will work without deleting any Indicator - but it will write in the Expert Advisor window which Indictors are present
https://c.mql5.com/3/332/IndicatorDelete.mq5
This is what I have!
Hello! I have implemented your script. Two indicators appeared in the Experts tab : Volumes and ZigZag (80,20,0). It is indeed so, only the ZigZag indicator is written without Color for some reason.
Regards, Vladimir.
Try this script
Good day everyone!
Aleksey, applied your script. I got error code 4115.
Regards, Vladimir.
I have to be more careful.
Indicator name and indicator short name often do not coincide.
Hello! I have applied your script. Two indicators appeared in the Experts tab: Volumes and ZigZag (80,20,0). It is indeed so, only the ZigZag indicator is written without Color for some reason.
Sincerely, Vladimir.
So, you have to write it like this - ZigZag (80,20,0).
It will definitely be deleted in this case.
-----------------
but withoutColor
because this is how it is written in the indicator
You have to write it like this - ZigZag (80,20,0)
The ZigZag will definitely be deleted.
-----------------
but withoutColor
because this is how it is written in the indicator
If you change the settings, you need to add those numbers that you have specified in the Indicator
for example