-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChartDrop.mq5
40 lines (36 loc) · 1.58 KB
/
ChartDrop.mq5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//+------------------------------------------------------------------+
//| ChartDrop.mq5 |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#include <MQL5Book/PRTF.mqh>
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
const int w = PRTF(ChartWindowOnDropped());
const datetime t = PRTF(ChartTimeOnDropped());
const double p = PRTF(ChartPriceOnDropped());
PRTF(ChartXOnDropped());
PRTF(ChartYOnDropped());
// for subwindows, map y coordinate to specific subwindow
if(w > 0)
{
const int y = (int)PRTF(ChartGetInteger(0, CHART_WINDOW_YDISTANCE, w));
PRTF(ChartYOnDropped() - y);
}
}
//+------------------------------------------------------------------+
/*
Example output (dropped on first subwindow with WPR indicator:
note that 'price' value is -50, because WPR range is between 0 and -100)
ChartWindowOnDropped()=1 / ok
ChartTimeOnDropped()=2021.11.30 03:52:30 / ok
ChartPriceOnDropped()=-50.0 / ok
ChartXOnDropped()=217 / ok
ChartYOnDropped()=312 / ok
ChartGetInteger(0,CHART_WINDOW_YDISTANCE,w)=282 / ok
ChartYOnDropped()-y=30 / ok
*/
//+------------------------------------------------------------------+