0

I am trying to plot a vertical line on the indicator window with its values. I came across OBJ_VLINE while reading the documentation. But the example is too hard to understand.
I have plotted the adx on the chart using the following expert:
input int Candles_for_adx = 5; input color maincolor_adx = Yellow, dpluscolor_adx=Lime,dminuscolor_adx = Red;

 void OnInit()
    {
    ChartIndicatorAdd(0,(int)ChartGetInteger(0,CHART_WINDOWS_TOTAL), 
 iCustom(_Symbol,PERIOD_M1,"ADX",Candles_for_adx,maincolor_adx,dpluscolor_adx,dminuscolor_adx) );
    }

I got the following in my output:
output image

What I am expecting to achieve:

expected image

How to write simple statements taking the coordinates and then plot the line?

user3666197
  • 1
  • 6
  • 50
  • 92
Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139

1 Answers1

0

and what is the problem? vertical line is infinite, it has one parameter (OBJPROP_TIME or OBJPROP_TIME1) and no PRICE paramters. What you have on the chart is TREND_LINE, it is a line that has its start (OBJPROP_TIME1,OBJPROP_PRICE1) and end(OBJPROP_TIME2,OBJPROP_PRICE2) and ObjectSetInteger(0,name,OBJPROP_RAY,false);.

So after adding ADX to the chart (by the way, why it has so many parameters? is it a custom ADX? if so, please make sure you called it correctly), draw the lines using ObjectCreate(0,name,subwindow,0,0) and set all its parameters (color, start and end point, RAY=false, width and some other parameters) after checking that object is created successfully. Maybe you will need a special function ObjDrawTrendLine(const string name,const int subwindow,const datetime dtStart,const double dStart,const datetime dtEnd,const double dEnd,const color clr) that will draw such objects, or move them if name is same. Subwindow should be received from CHART_WINDOWS_TOTAL or externally.

Daniel Kniaz
  • 4,603
  • 2
  • 14
  • 20
  • Have you seen the image I have mentioned in my question? If you can tell me solution for that condition then it will be excellent... – Jaffer Wilson Mar 19 '18 at 13:38
  • yes I saw the charts you attached. and as i told you, you drew trend lines not vertical lines, so please decide what you really need - vertical or trend lines, first, and then Create objDrawTrendLine() function, if you have problems with it - please show what you did and hwat is the problem – Daniel Kniaz Mar 19 '18 at 14:33