DeleteAllObjects

Author: Copyright 2014, ForexTradingAutomation.com
0 Views
0 Downloads
0 Favorites
DeleteAllObjects
//+------------------------------------------------------------------+
//|                                             DeleteAllObjects.mq4 |
//|                       Copyright 2014, ForexTradingAutomation.com |
//|                                http://ForexTradingAutomation.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, ForexTradingAutomation.com"
#property link      "http://ForexTradingAutomation.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   long currChart;
   long prevChart=ChartFirst();
   int deleted = ObjectsDeleteAll(prevChart);
   int chartCount = 1;
   // Loop through charts
   while(true)
     {
      // Get next chart
      currChart=ChartNext(prevChart);
      // If currChart < 0 ==> we iterated through all charts, exit loop
      if(currChart<0)
         break;
      deleted += ObjectsDeleteAll(currChart);
      chartCount++;
      prevChart=currChart;
     }
   PrintFormat("Deleted %d objects on %d charts", deleted, chartCount);     
  }
//+------------------------------------------------------------------+

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 ---