거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
라이브러리

CRect and CCanvas replacement (Standard Library - several bugs fixed) - MetaTrader 5용 라이브러리

게시자:
Doerk Hilger
조회수:
6794
평가:
(24)
게시됨:
2015.10.05 13:13
업데이트됨:
2016.11.22 07:32
\MQL5\Include\Controls\
rect.mqh (12.53 KB) 조회
\MQL5\Include\Canvas\
canvas.mqh (82.83 KB) 조회
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

Real author:

MetaQuotes Software, Bugfixes & Enhancements by Doerk.

When you start to work on a pixel basis with the standard library, you'll soon figure out, that sometimes a pixel here and there is missing. This weird behavior is caused mainly by several bugs in the CRect class. The main problem here is, that the original class is failing by calculating the height and the width of a rectangle, which influences almost ALL classes which derive from CWnd, because CWnd is graphically based on CRect.

In the original CRect, the width is calculated as following:

width = x2 - x1

This is simply wrong. When you create any rectangular object starting from 0,0 until 10,10, then the width of the object is 11 pixels, not 10 pixels. Therefore, the right answer is

width = x2 - x1 +1

In some other classes of the standard library it's calculated right, sometimes, but also not always (i.e. in CCanvas when creating and addressing the resource in memory, but not when filling a rectangle). Anyway, it's an inconsistent behavior and should be corrected.

It's now possible to compare two rectangles by using normal operators like == != >= <= > <

instead of coding

if (rect1.left==rect2.left && rect1.top==rect2.rect.top && rect1.right==rect2.rect.right && rect1.bottom==rect2.bottom)

you type now just

if (rect1==rect2)

Furhtermore, unary operators like ++, --, + are supported as well and expand or inflate a rectangle.

Recommendations:

  • Replace the Rect.mqh by this file in the Controls folder. Don't put it into another folder, it simply won't work.
  • Replace the Canvas.mqh by the attached file in the Canvas folder. Don't put it into another folder, it won't work.
  • Make a backup of this file and restore it on new releases of MetaTrader into the original folder.
  • If MetaQuotes decides to replace the originals by these files, I think you'll be informed anyway.
Fuzzy - library for developing fuzzy models Fuzzy - library for developing fuzzy models

FuzzyNet library for developing fuzzy models was written in C#. While converting to MQL5, 8 membership functions and 4 defuzzification methods for Mamdani-type systems were added to the library.

CWndContainer Replacement CWndContainer Replacement

This file replaces the WndContainer.mqh original file. It prevents the chart from being affected when you click and hold the mouse inside a container area.

Flat-Trend_HTF Flat-Trend_HTF

The Flat-Trend indicator with the timeframe selection option available in the input parameters.

Flat_HTF Flat_HTF

The Flat indicator with the timeframe selection option available in the input parameters.