거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
조회수:
8452
평가:
(35)
게시됨:
2018.01.22 09:39
\MQL5\Include\fxsaber\Clock\
Canvas.mqh (0.36 KB) 조회
Color.mqh (1.48 KB) 조회
File.mqh (2.45 KB) 조회
Image.mqh (1.17 KB) 조회
Pixel.mqh (0.33 KB) 조회
Settings.mqh (1.26 KB) 조회
Layer.mqh (2.05 KB) 조회
\MQL5\Include\fxsaber\
Clock.mqh (1.65 KB) 조회
\MQL5\Indicators\fxsaber\
Clock.mq5 (2.84 KB) 조회
\MQL5\Files\
Clocks.zip (903.45 KB)
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

The library (Clock.mqh) allows creating analog clocks as graphical resources.


Features

The use of the library is shown in the following source code:

// MQL4&5-code
// An example of a cross-platform Expert Advisor, which creates an analog clock on the chart

#property strict

#include <fxsaber\Clock.mqh> // https://www.mql5.com/en/code/19388

const string ObjName = __FILE__;            // The name of the Bitmap object to display the clock
const string ResourceName = "::" + ObjName; // The name of the resource where the clock will be formed

// Creating the clock from the settings of the corresponding INI file
CLOCK Clock("Clocks\\Clock01\\Clock01.INI", ResourceName);

void OnINIt()
{
  // Creating a graphical object for displaying the clock
  ObjectCreate(0, ObjName, OBJ_BITMAP_LABEL, 0, 0, 0);

  // Specifying the name of the resource where the clock is located
  ObjectSetString(0, ObjName, OBJPROP_BMPFILE, 0, ResourceName);

  // Adding the possibility to select the object to drag it with the mouse
  ObjectSetInteger(0, ObjName, OBJPROP_SELECTABLE, true);

  // Enabling the second timer to update the clock
  EventSetTimer(1);
}

void OnTimer()
{
  // Setting the current time on the clock
  Clock.SetTime(TimeLocal());

  // Refreshing the chart to make changes visible
  ChartRedraw();
}

The following clock appears on the chart after refresh:


Indicator

The attached cross-platform Clock.mq5 indicator enables the immediate "out of the box" use of the clock.

The indicator implements an interactive change of skins: clock versions (unpack the ZIP archive) are switched using the UP/DOWN keys on the keyboard.


Features

  • Raster (not vector) clock;
  • Hour hands move without smoothing;
  • The library can be used in MetaTrader 4/5.


How the clock is formed

The originals of clock are taken from the web by searching for flash clock (swf files are available in the ZIP), which are convenient because they contain required graphical representations of clock face, hands, etc. You can use any other sources. For example, you can find ready vector files or draw them yourself.

INI files (see examples) set the parameters of clock formation layer by layer. The below settings can be edited in any text editor

ImageName = ClockFace.bmp
BoundX = 0 // the X coordinate of the zero point inside the bmp image (layer)
BoundY = 0 // the Y coordinate of the zero point inside the bmp image (layer)
X = 0      // the X coordinate of the zero point inside the image being formed of layers
Y = 0      // the Y coordinate of the zero point inside the image being formed of layers
Rotate = 0 // Speed of rotation
A = 100%   // The value of the Alpha channel used
R = 100%   // The value of the Red channel used
G = 100%   // The value of the Green channel used
B = 100%   // The value of the Blue channel used

The lower the position of a layer description in the list, the higher it is than previously described layers. There is no special limitation on the number of layers.

This image construction method allows using the library for forming any static/dynamic objects, not only the clock. To provide the clock dynamics, we only needed to set rotation. However, other types of movement (such as shift, scaling, etc.) can be added to the code in just a few lines. The attached source code provides an example of how to implement this approach when describing images.

As for the clock, the layer-by-layer operation allowed us to implement shadows of hands and illumination (as is done in flash clocks).

If you want to make the dial transparent, you should set the Alpha channel in the corresponding INI file less than 100%:

Alpha channel of the dial 90% (A = 90)

At the time of publication, there were no analog clocks in the Market. I've found this variant in the Code Base.

The new feature of this library is LAYER::Rotate used for rotation. Probably, this function will lead to the creation of third-party solutions based on dynamic graphical resources similar to the clock.

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/19388

JS-Chaos JS-Chaos

The Expert Advisor is based on Bill Williams' strategy.

KI_signals_v2 KI_signals_v2

A trend indicator, which receives trade signals from the XMACD histogram.

N seconds N points N seconds N points

The Expert Advisor tracks positions of all symbols with all magic numbers. If a position has been open for "Waiting for seconds" and its profit has reached "Take Profit" points, the EA closes the position. If the profit has not reached "Take Profit" points, the EA moves the take profit level.

Dtm Dtm

An oscillator in the DRAW_FILLING style, using digital filters.