Author: Copyright 2011, Alexander Piechotta
0 Views
0 Downloads
0 Favorites
Example_3
//+------------------------------------------------------------------+
//|                                                    Example 3.mq5 |
//|                              Copyright 2011, Alexander Piechotta |
//|                                        http://www.metatraders.de |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011, Alexander Piechotta"
#property link      "http://www.metatraders.de"
#property version   "1.00"

#include <MyComment.mqh>

MyComment AddComment;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   long p_handle=0;
   long handle=ChartNext(p_handle);

   while(handle!=-1)
     {
      p_handle=handle;

      AddComment.chartID=handle;
      AddComment.Add_MyComment("This comment will be deleted in 10 Sektunden on the GBPUSD.");

      handle=ChartNext(p_handle);
     }

//--- create timer
   EventSetTimer(10);

   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {

  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
   long p_handle=0;
   long handle=ChartNext(p_handle);

   while(handle!=-1)
     {
      p_handle=handle;

      // delete all my Comments from Symbol GBPUSD
      if(ChartSymbol(handle)=="GBPUSD")
        {
         AddComment.chartID=handle;
         AddComment.Del_MyComments();
        }

      handle=ChartNext(p_handle);
     }
  }
//+------------------------------------------------------------------+

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