You are drawing lines so they are connected like that.
If you want to cut the line you need two more parameters like time_start and time_stop and price start and price stop.
Then price start and stop will be the same for a horizontal line but time start and time stop will differ.
On another note you can try :
For the function PlotIndexSetDouble()
ID | Description | Property type |
PLOT_EMPTY_VALUE | An empty value for plotting, for which there is no drawing | double |
Hello Marco,
Thank you very much for the answer!
I've added following lines at the end of init() function but it still draws the connections.What else can I try?
PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(4,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(5,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(6,PLOT_EMPTY_VALUE,0.0);
No you have to feed EMPTY_VALUE only on the bars buffer that you want to suppress.
It is not that easy you have to compare the bar value with the previous bar value to see if they are equal or differ to be able to intercept the unwanted bars and suppress the output.
If you ask me, i would just leave it there it's not worth the hassle.
But you can also read this :
https://www.mql5.com/en/docs/constants/namedconstants/otherconstants
- www.mql5.com
Thank you Marco,
I'll stop, If it will be so complicated. I thought that could be easier :s Thank you for answering anyway.
Only a two bar gap is possible, unfortunately.
SetIndexBuffer(0,PBuffer); SetIndexBuffer(1,S1Buffer); SetIndexBuffer(2,R1Buffer); SetIndexBuffer(3,S2Buffer); SetIndexBuffer(4,R2Buffer); SetIndexBuffer(5,S3Buffer); SetIndexBuffer(6,R3Buffer); SetIndexEmptyValue(0,EMPTY_VALUE); SetIndexEmptyValue(1,EMPTY_VALUE); SetIndexEmptyValue(2,EMPTY_VALUE); SetIndexEmptyValue(3,EMPTY_VALUE); SetIndexEmptyValue(4,EMPTY_VALUE); SetIndexEmptyValue(5,EMPTY_VALUE); SetIndexEmptyValue(6,EMPTY_VALUE); if(counted_bars==0) counted_bars=1; if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; for(int i=limit-1; i>=0 && !_StopFlag; i--) { R3Buffer[i]=R3!=R3Buffer[i+1] && R3Buffer[i+1]!=EMPTY_VALUE?EMPTY_VALUE:R3; R2Buffer[i]=R2!=R2Buffer[i+1] && R2Buffer[i+1]!=EMPTY_VALUE?EMPTY_VALUE:R2; R1Buffer[i]=R1!=R1Buffer[i+1] && R1Buffer[i+1]!=EMPTY_VALUE?EMPTY_VALUE:R1; PBuffer[i]=P!=PBuffer[i+1] && PBuffer[i+1]!=EMPTY_VALUE?EMPTY_VALUE:P; S1Buffer[i]=S1!=S1Buffer[i+1] && S1Buffer[i+1]!=EMPTY_VALUE?EMPTY_VALUE:S1; S2Buffer[i]=S2!=S2Buffer[i+1] && S2Buffer[i+1]!=EMPTY_VALUE?EMPTY_VALUE:S2; S3Buffer[i]=S3!=S3Buffer[i+1] && S3Buffer[i+1]!=EMPTY_VALUE?EMPTY_VALUE:S3;
Thank you very much Ernst, the code you wrote looks very elegant. I tried to integrate it into the indicator but it seems like same drawing. Maybe I messed up! Can you see if I did wrong?
Thanks a lot
Thank you very much Ernst, the code you wrote looks very elegant. I tried to integrate it into the indicator but it seems like same drawing. Maybe I messed up! Can you see if I did wrong?
Thanks a lot
The loop parts aren't edited.
if(counted_bars==0) counted_bars=1; if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; for(int i=limit-1; i>=0 && !_StopFlag; i--) {
You are the king Ernst. My first ever help request from the community and you did it right away.
It worked few times but then somehow I cannot load the indicator to the chart. I "drag" and "drop" indicator to my chart but nothing happens. When I check "journal" tab it shows like this ;
I've restarted my mt4, I've restarted my computer but result is same. My build is 1090. Any idea what I can try?
Thanks in advance
Cheers
You are the king Ernst. My first ever help request from the community and you did it right away.
It worked few times but then somehow I cannot load the indicator to the chart. I "drag" and "drop" indicator to my chart but nothing happens. When I check "journal" tab it shows like this ;
I've restarted my mt4, I've restarted my computer but result is same. My build is 1090. Any idea what I can try?
Thanks in advance
Cheers
I've no idea. The file I've attached is working for me.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello dear friends,
What can I change in this code so it doesn't draw connection between pivot lines? It makes it confusing for me.
Thanks in advance for your help.