SnapShotI_v2

Author: Copyright � 2006, MQLService
SnapShotI_v2
0 Views
0 Downloads
0 Favorites
SnapShotI_v2
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                                    SnapShotI.mq4 |
//|                                     Copyright © 2006, MQLService |
//|                                        http://www.mqlservice.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MQLService"
#property link      "http://www.mqlservice.com"
#include <stdlib.mqh>

#property indicator_chart_window

extern int DelayTicks  = 1; // Delay so many ticks after new bar
extern int ShotsPerBar = 1; // How many screen shots per bar

int start(){
   static datetime last_bar;
   static int DoShot    = -1;
   static int old_phase = 3000000;
   
   if(ShotsPerBar > 0)
     int shot_interval = MathRound((60*Period())/ShotsPerBar);
   else
     shot_interval = 60*Period();
   int phase = MathFloor((CurTime()-Time[0])/shot_interval);
   
   if(Time[0] != last_bar){
     last_bar = Time[0];
     DoShot = DelayTicks;
   }else if(phase > old_phase)
     MakeScreenShot("i");
   old_phase = phase;

   if(DoShot == 0) MakeScreenShot();
   if(DoShot >= 0) DoShot -= 1;

   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(string sx=""){
  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+sx+".gif";
  if(!ScreenShot(fn,640,480)) Print("ScreenShot error: ", ErrorDescription(GetLastError()));
}
//+---- Programmed by Michal Rutka -----------------------------------------+

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