BreakPointTest

Author: Copyright � 2009, Marketeer
0 Views
0 Downloads
0 Favorites
BreakPointTest
//+------------------------------------------------------------------+
//|                                               BreakPointTest.mq4 |
//|                                      Copyright © 2009, Marketeer |
//|                                                     www.mql4.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Marketeer"
#property link      "http://www.mql4.com"

#include <BreakPoint.mqh>

#import "kernel32.dll"
int SleepEx(int dwMilliseconds,	// time-out interval in milliseconds  
            int bAlertable); 	  // early completion flag 
#import

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
{
  return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
{
  return(0);
}

int Cancelled = 0;

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
  if(TimeHour(Time[0]) == 12 && TimeMinute(Time[0]) == 0)
  {
    PauseTester();
  }

  if(TimeHour(Time[0]) == 18 && TimeMinute(Time[0]) == 0)
  {
    // create progress indicator, pass 0 as 2-nd parameter
    ShowProgress("start...", 0);
    for(int i = 0; i < 100 && Cancelled == 0; i++)
    {
      Cancelled = ShowProgress(TimeToStr(Time[0]) + ": iteration " + (i+1), i+1);

      // ... a code goes here
      SleepEx(100, 0); // we use the system function cause the built-in mql4's Sleep is a fake
    }
    // remove progress indicator, pass >100 as 2-nd parameter
    ShowProgress("", 101);
  }

  if(TimeHour(Time[0]) == 23 && TimeMinute(Time[0]) == 0 && Cancelled == 0)
  {
    // ... long calculations go here
  
    // if user presses Cancel button, all the block gets disabled
    Cancelled = BreakPoint(TimeToStr(Time[0]));
  }
  
  return(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 ---