Custom Indicator Development Question

 

All,

I am developing a Custom Indicator and had the following queries. I use two buffers to draw the line indicators.

a) Possibility / Workarounds available to draw a line indicator on a single bar, ie the start point and the end point of the indicator line will be on the same bar

b) Any MQL4 function available to set the depth of the indicator lines, ie I want to draw the Indicator lines on top of bars

Thanks in advance

PR

 

a. Do you mean a Histogram ?

b. Put the chart on the background, i.e. not on foreground - F8, Common, Chart on foreground --> unticked.

 

Hi RaptorUK,

Thanks for the response.

On a) I want to draw a line indicator (not histogram) for a single bar, ie start point of the line will be H, and end point of the line will be L.

 
Not possible, you will have to use a histogram to be able to set start and endpoint on the same bar
 
Not sure that you can do that with a line . . . how can it have 2 values for the same bar number ? can be done with a Histogram as you use 2 indicator buffers., one for start (Low) and another for end (High). What you are describing, a line from Low to High, sounds exactly like a Histogram to me . . . why do you think it isn't ?
 
RaptorUK:
Not sure that you can do that with a line . . . how can it have 2 values for the same bar number ? can be done with a Histogram as you use 2 indicator buffers., one for start (Low) and another for end (High). What you are describing, a line from Low to High, sounds exactly like a Histogram to me . . . why do you think it isn't ?


Heiken Ashi for example do like this .. repaint the bar in other color/style.

I guess he mean something like this.

So, AnkaSoftware, take a look at the code how is done in Heiken Ashi

 

Ah, sorry.

"Repaint the bar" in my posting before was not correct.

It paint something over the Bar in the chart :-)

 
EADeveloper:


Heiken Ashi for example do like this .. repaint the bar in other color/style.

I guess he mean something like this.

So, AnkaSoftware, take a look at the code how is done in Heiken Ashi

Had a look at the Heiken Ashi code . . . . it uses Histograms ;-)

   SetIndexStyle(0, DRAW_HISTOGRAM, 0, 1, color1);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1, DRAW_HISTOGRAM, 0, 1, color2);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexStyle(2, DRAW_HISTOGRAM, 0, 2, color3);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexStyle(3, DRAW_HISTOGRAM, 0, 2, color4);
   SetIndexBuffer(3, ExtMapBuffer4);
 
AnkaSoftware:
a) Possibility / Workarounds available to draw a line indicator on a single bar, ie the start point and the end point of the indicator line will be on the same bar
b) Any MQL4 function available to set the depth of the indicator lines, ie I want to draw the Indicator lines on top of bars
  1. Not with a line indicator, use
    SetIndexStyle(0,DRAW_ARROW);
    SetIndexArrow(0,4); // En Dash symbol (-)
    See Arrow codes and also wingDings
  2. Don't think so. You can with objects (OBJPROP_BACK)
 
WHRoeder:
  1. Not with a line indicator, use See Arrow codes and also wingDings
  2. Don't think so. You can with objects (OBJPROP_BACK)

All,

Thanks for the posts.

I also draw the indicators across bars, ie start point of the line on bar T+2, and end point on T0. Using DRAW_HISTOGRAM has the limitation that it cannot be drawn across bars, isnt it?

Reason: