Author: Michal Rutka
SnapShotEA
0 Views
0 Downloads
0 Favorites
SnapShotEA
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                   SnapShotEA.mq4 |
//|                                                     Michal Rutka |
//|                                               www.mqlservice.com |
//|                                                                  |
//| Creates a screen shot at beginning of every new bar. GIFs are    |
//| placed in experts/files/ subdirectory of your MetaTrader         |
//| instalation. Use this utility when you want manually test your   |
//| strategy, to spot if you have any indicators that change its     |
//| past values.                                                     |
//+------------------------------------------------------------------+
#property copyright "Michal Rutka"
#property link      "www.mqlservice.com"

int start(){
   static datetime last_bar;
   if(Time[0] != last_bar){
     last_bar = Time[0];
     MakeScreenShot();
   }
   return(0);
}

string al0(int number, int digits){
  // add leading zeros that the resulting string has 'digits' length.
  string result;
  result = DoubleToStr(number, 0);
  while(StringLen(result)<digits) result = "0"+result;
  return(result);
}

void MakeScreenShot(){
  static int no=0;
  no++;
  string fn = "SnapShot"+Symbol()+Period()+"\\"+Year()+"-"+al0(Month(),2)+"-"+al0(Day(),2)+" "+
              al0(Hour(),2)+"_"+al0(Minute(),2)+"_"+al0(Seconds(),2)+" "+no+".gif";
  if(!ScreenShot(fn,640,480)) Print("ScreenShot error: ", GetLastError());
}

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