Help us understand the problem. What is going on with this article?

[MQL5]クリックした場所に横線を引くスクリプト

More than 1 year has passed since last update.
//+------------------------------------------------------------------+
//|                                                   LineRedraw.mq5 |
//|                                                Shintaro Tanikawa |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Shintaro Tanikawa"
#property link      "https://www.mql5.com"
#property version   "1.00"

static const string vLineName = "V-Line";
static const string hLineName = "H-Line";

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
  if (id == CHARTEVENT_CLICK)
  {
    const int x = (int)lparam;
    const int y = (int)dparam;
    datetime dt = 0;
    double price = 0;
    int window = 0;
    long chartId = ChartID();
    if (ChartXYToTimePrice(chartId, x, y, window, dt, price))
    {
      CreateHLine(chartId, window, dt, price);
      //CreateVLine(chartId, window, dt, price);

      ChartRedraw(chartId);
    }
  }
}

void CreateHLine(long chartId, int window, datetime dt, double price)
{
  if (ObjectFind(chartId, hLineName))
  {
    ObjectDelete(chartId, hLineName);
  }

  ObjectCreate(chartId, hLineName, OBJ_HLINE, 0, dt, price);
  ObjectSetInteger(chartId, hLineName, OBJPROP_COLOR, clrRed);
}

void CreateVLine(long chartId, int window, datetime dt, double price)
{
  if (ObjectFind(chartId, vLineName))
  {
    ObjectDelete(chartId, vLineName);
  }

  ObjectCreate(chartId, vLineName, OBJ_VLINE, 0, dt, price);
  ObjectSetInteger(chartId, vLineName, OBJPROP_COLOR, clrRed);
}
//+------------------------------------------------------------------+

tani-shi
フリーのソシャゲ開発のエンジニアです。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした