How to create simple custom indicator to draw horizontal lines? pls help :)

 

Hi, I am trying to create a custom indi to draw simple horizontal lines at specific prices. I will enter those prices manually.

Would you guys pls help me on this. I hope this should be very simple for the person who can code. I can continue working on it.

Many thanks in advance :) 

 
bayan_trader: . I hope this should be very simple for the person who can code.
  1. It should be simple to code. So do it.
  2. learn to code it, or pay someone. We're not going to code it FOR you.
    We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
 
Read the help file for ObjectCreate
 
WHRoeder:
bayan_trader: . I hope this should be very simple for the person who can code.
  1. It should be simple to code. So do it.
  2. learn to code it, or pay someone. We're not going to code it FOR you.
    We are willing to HELP you when you post your attempt (using SRC)and the nature of your problem.

hi, thank you for replying. I am not a programmer but I am trying to draw multiple horizontal lines.

 Is this could be a start? I can't compile this code because of some errors. would you pls help me to fix it?

 Thanks 

//+------------------------------------------------------------------+
//|                                                         Bato.mq4 |
//|                                             Copyright 2016, BATO |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, BATO"
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window

//+------------------------------------------------------------------+
//| Create the horizontal line                                       |
//+------------------------------------------------------------------+
bool HLineCreate(const long            chart_ID=0,        // chart's ID
                 const string          name="HLine",      // line name
                 const int             sub_window=0,      // subwindow index
                 double                price=0.9645,           // line price
                 double                price=0.9640,           // line price
                 double                price=0.9658,           // line price
                 double                price=0.9662,           // line price
                 const color           clr=clrDarkGray,        // line color
                 const ENUM_LINE_STYLE style=STYLE_DOT, // line style
                 const int             width=1,           // line width
                 const bool            back=false,        // in the background
                 const bool            selection=true,    // highlight to move
                 const bool            hidden=true,       // hidden in the object list
                 const long            z_order=0)         // priority for mouse click

  
  }
//+------------------------------------------------------------------+
 

guys is it possible to draw 2 horizontal lines (open and close of the candle) by entering dates into the code?

is this the code for that? How can i use it?

double  ObjectGetValueByTime(
   long       chart_id,      // chart ID
   string     object_name,   // object name
   datetime   time,          // time
   int        line_id=0      // line ID
   );
 
bayan_trader:

hi, thank you for replying. I am not a programmer but I am trying to draw multiple horizontal lines.

 Is this could be a start? I can't compile this code because of some errors. would you pls help me to fix it?

 Thanks 

 

You can't compile it because you have a function with no execution code. In fact no code at all, just parameters passed to a function
 
bayan_trader:

guys is it possible to draw 2 horizontal lines (open and close of the candle) by entering dates into the code?

is this the code for that? How can i use it?

 

You can't just copy and paste blocks of code from the documentation and expect them to work.

You have to ubderstand what you are trying to achieve and learn the methods to do that.

Coding in mql4 takes study time and effort, you can't just jump in and do it without learning the basics.

 
bayan_trader: Hi, I am trying to create a custom indi to draw simple horizontal lines at specific prices. I will enter those prices manually. Would you guys pls help me on this. I hope this should be very simple for the person who can code. I can continue working on it. Many thanks in advance :)
Unless you already have some good experience in coding in languages like C or C++ or the like, don't think that you can just code an Indicator or EA by simply glancing at the documentation and a few copy/pasts.

You should first learn coding in general in C, before moving onto MQL4 and it takes many months (even a couple of years), for a complete beginner, to properly learn to code Indicators or EAs in MQL.

You need time to properly gain the necessary knowledge and coding experience for it. Obviously, if you are serious about it and have the dedication to stick with it, then go for it. But remember that it is a long-term project, and not short term.

If however, you are not serious about learning to code, or you need a solution quickly, then please consider hiring someone to code for you. Go to the Freelance section and place a Job advert, stating your budget and describing your requirements.
Reason: