Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // please run on build610
- #property strict
- int OnInit()
- {
- ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, true);
- // enable tracking of mouse events
- ChartRedraw();
- return 0;
- }
- void OnDeinit(const int reason)
- {
- if (reason == REASON_REMOVE || reason == REASON_RECOMPILE) {
- ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, false);
- ChartRedraw();
- }
- }
- void OnChartEvent(const int id,
- const long &lparam, // x
- const double &dparam, // y
- const string &sparam) // mouse_up, mouse_down (MOUSE_MOVE
- {
- int x = (int)lparam;
- int y = (int)dparam;
- int window = WRONG_VALUE;
- datetime time = NULL;
- double price = 0.0;
- if (id == CHARTEVENT_MOUSE_MOVE) {
- ObjectSetInteger(0, "0", OBJPROP_CORNER, CORNER_LEFT_LOWER);
- if (ChartXYToTimePrice(0, x, y + 1, window, time, price)) {
- Comment("x: ", x, "\n", // 最小値が 3 なのは,チャートの枠内だけに
- "y: ", y, "\n", // 注目してる関数だから
- "time: ", time, "\n",
- "price: ", DoubleToString(price, _Digits));
- }
- return;
- }
- ChartRedraw();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement