Download MetaTrader 5

DRAW_SECTION but with spaces

To add comments, please log in or register
Ocelot
24
Ocelot  

How can I draw lines using buffers in an EA to produce the following effect? Using one buffer with DRAW_SECTION makes one continuous line, I want it broken up into segments like this -

 

 Thanks in advance! 

whroeder1
17105
whroeder1  
You'll have to use DRAW_LINE and linear interpolate buffer elements between the two end points.
Not compiled, not tested.
void draw_segment(double& buffer[], double vLast, int iLast, double vBeg, int iBeg){
   for(int iBar = iLast; iBar >= iBeg; --iBar)
      buffer[iBar] = vBeg + (vLast-vBeg) * (iBar-iBeg) / (iLast-iBeg);
}
Not compiled, not tested.
Stanislav Korotky
23379
Stanislav Korotky  
ggladden:

How can I draw lines using buffers in an EA to produce the following effect? Using one buffer with DRAW_SECTION makes one continuous line, I want it broken up into segments like this -

Try to place EMPTY_VALUE inbetween of visible sections.
Alain Verleyen
Moderator
29862
Alain Verleyen  
ggladden:

How can I draw lines using buffers in an EA to produce the following effect? Using one buffer with DRAW_SECTION makes one continuous line, I want it broken up into segments like this

Stanislav Korotky:
Try to place EMPTY_VALUE inbetween of visible sections.

Cannot be done with DRAW_SECTION.

WHRoeder proposed a solution, there are others.

To add comments, please log in or register