Del_Indicator

Author: MVS © 2019
Miscellaneous
It opens Message Boxes to the userIt issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
Del_Indicator
ÿþ//+------------------------------------------------------------------+

//|                                          Delete Indicators mq4/5 |

//|                                                       MVS © 2019 |

//+------------------------------------------------------------------+

#property copyright "MVS © 2019"

#property link      "https://www.mql5.com/ru/users/mvs/seller"

#property version   "1.02"

#property strict

#property script_show_inputs

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

enum Ind 

  {

   ind_1, // Delete All

   ind_2, // Candles_Arr

   ind_3, // Signal Color

   ind_4  // ZigZag

  };

input Ind num= ind_1; // Name

string name[]=

  {

   "Delete All", // Delete All

   "Candles_Arr", // Indicator name 1

   "Signal Color", // Indicator name 2

   "ZigZag" // Indicator name 3

  };



long list_id[];

//+------------------------------------------------------------------+

//| Script program start function                                    |

//+------------------------------------------------------------------+

void OnStart()

  {

   int size=ChartGetIDList(list_id);

   for(int i=size-1;i>=0;i--) 

     {

      long id=list_id[i];

      for(int e=ChartWindowsTotal(id)-1;e>=0;e--) 

        {

         for(int k=ChartIndicatorsTotal(id,e)-1;k>=0;k--) 

           {

            string IndDel=name[num];

            string IndName=ChartIndicatorName(id,e,k);

            if(IndName==IndDel || num==0) 

              {

               int Confirm=MessageBox("Delete: "+ChartSymbol(id)+": "+IndName,"Delete Indicator",MB_YESNOCANCEL|MB_ICONQUESTION);

               if(Confirm==6) 

                 {

                  PrintFormat("Delete Indicator: %s: %s",ChartSymbol(id),IndName);

                  ChartIndicatorDelete(id,e,IndName);

                 }

               if(Confirm==2)

                  return;

              }

            else

               Alert("Indicator: ",IndDel,": Not found");

           }

        }

     }

  }

//+------------------------------------------------------------------+ 

//| $C=:F8O A>18@05B 2 <0AA82 ID >B:@KBKE >:>= 3@0D8:0               |

//+------------------------------------------------------------------+ 

int ChartGetIDList(long &List[]) 

  {

   int i=0;

   long chartID=ChartFirst();

   while(chartID!=-1) 

     {

      i++;

      ArrayResize(List,i);

      List[i-1]=chartID;

      chartID=ChartNext(chartID);

     }

   return(ArraySize(List));

  }

//+------------------------------------------------------------------+ 

//| $C=:F8O ?>;CG05B >1I55 :>;8G5AB2> >:>= 3@0D8:0, 2:;NG0O ?>4>:=0  | 

//| 8=48:0B>@>2.                                                     | 

//+------------------------------------------------------------------+ 

int ChartWindowsTotal(const long chart_ID=0) 

  {

   return((int)ChartGetInteger(chart_ID,CHART_WINDOWS_TOTAL,0));

  }

//+------------------------------------------------------------------+ 

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---