Download MetaTrader 5

mqh with useful functions (pixel coordinates to price and bar conversion and phew more)

To add comments, please log in or register
Mihai Ionescu
1354
Mihai Ionescu 2010.05.21 23:17 

I made an mqh because of some holes in MQL5 and I wanted to publish it. It's commented so it wouldn't be much of a problem to understand the functions.

Mqh file must be in the same directory with your indicator. Use:

 #include "utils.mqh"   

1. Accessing the information of ONE candlestick of timeseries it's too complicated in MQL5 => I made the function barInfo(const int k). In I want the info for the k candlestick, now it's easy.

2. If I want to click somewhere with the mouse and I want to know the candlestick underneath, I use xToBar(xCoordinate) function.

3. The same as 2, but I want to know the datetime underneath the mouse, I use xToTime(xCoordinate) function.

4. The same as 2, but I want to get the entire MqlRates struct, all info for the candlestick, I use xToBarInfo(xCoordinate) function.

5. If I want to know the price underneath when I click the mouse, I use yToPrice(yCoordinate) function.

--------

Besides all this, I included 2 more useful functions (for me at least), deleteObjectsByPrefix (delete all objects that start with a prefix), and I imported ShellExecuteW from shell32.dll to be able to launch applications from Metatrader (like launching notepad.exe as in the example somewhere around here in forum)(Thank you by the way for the possibility.. I wasn't aware of it).

I will update the file when I improve it.

I hope it's useful.  

 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Data Structures / History Data Structure
  • www.mql5.com
Standard Constants, Enumerations and Structures / Data Structures / History Data Structure - Documentation on MQL5
Files:
utils.mqh 4 kb
To add comments, please log in or register