HistoryToImages

0 Views
0 Downloads
0 Favorites
HistoryToImages
#property show_inputs

extern int Width = 1280;
extern int Height = 800;

#import "user32.dll"
  int GetClientRect( int hWnd, int lpRect[] );
#import

#define BORDER_SIZE 44

int GetBarSize()
{
  int Rect[4], PrevBars, PrevRect, Res = 1;
  int hwnd = WindowHandle(Symbol(), Period());

  GetClientRect(hwnd, Rect);
  PrevRect = Rect[2] - BORDER_SIZE;
  PrevBars = WindowBarsPerChart();

  PrevBars += PrevBars;
    
  while(PrevBars <= PrevRect)
  {
    Res += Res;
    PrevBars += PrevBars;
  }
  
  return(Res);
}

string StrNumToLen( string Num, int Len )
{
  Len -= StringLen(Num);
  
  while (Len > 0)
  {
    Num = "0" + Num;
    Len--;
  }
  
  return(Num);
}

void start()
{
  int Pos = WindowFirstVisibleBar(), Step, i = 1;
  string Directory = Width + "x" + Height + "_" + Symbol() + Period() + " (" +
                     TimeToStr(Time[Pos], TIME_DATE) + "-" +
                     TimeToStr(Time[0], TIME_DATE) + ")/";

  Pos += 2;
  Step = 1 + (Width - BORDER_SIZE) / GetBarSize();
  
  while (Pos >= 0)
  {
    WindowScreenShot(Directory + StrNumToLen(i, 5) + ".gif", Width, Height, Pos);
    i++;
    Pos -= Step;
  }
  
  return;
}

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