1. Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)
    Dismiss Notice

I want to make an indicator that always draws a vertical line 10 hours ago.

Discussion in 'Belajar MQL dari Nol' started by yyyyy, 04 Apr 2020.

Tags:
  1. yyyyy

    yyyyy New Member

    Equity
    Credit
    Ref Point
    I want to make an indicator that always draws a vertical line 10 hours ago.
    It is displayed 10 hours before the candlestick changes.
    Displayed 10 hours before any time bar.

    Please teach.


    #property indicator_chart_window
    #property indicator_buffers 0
    #property indicator_plots 0
    #property strict
    extern int hour = 10; //
    extern ENUM_LINE_STYLE LineStyle = STYLE_DOT; // Lines style
    extern int LineWidth = 0; // Lines width
    extern color LineColor = clrGray; // Lines color

    //------------------------------------------------------------------
    //
    //------------------------------------------------------------------

    int OnInit()
    {

    return(0);
    }

    int OnDeinit()
    {
    ObjectsDeleteAll();
    return(0);
    }

    int start()
    {
    string name;
    datetime time = TimeCurrent()-(3600*hour);
    ObjectCreate(name,OBJ_VLINE,0,TimeCurrent()-(3600*hour),0);
    ObjectSet(name,OBJPROP_STYLE,LineStyle);
    ObjectSet(name,OBJPROP_WIDTH,LineWidth);
    ObjectSet(name,OBJPROP_COLOR,LineColor);
    ObjectSet(name,OBJPROP_BACK,1);
    ObjectSet(name,OBJPROP_SELECTABLE,0);

    return(0);
    }
     
  2. stadevata

    stadevata Active Member Credit Hunter

    Equity
    Credit
    Ref Point
    must define variable name

    variable ---> string name;
    should be define ---> string name = "VLine";

    time already define ---> datetime time = TimeCurrent()-(3600*hour);
    u just need to write ---> ObjectCreate(name,OBJ_VLINE,0,time,0);
     

Share This Page