I just asked for a clue on both sites to maybe get a quicker answer... Is that bad? Im sorry. You can delete the thread if you want to.
Thanks for your help!
I just asked for a clue on both sites to maybe get a quicker answer... Is that bad? Im sorry. You can delete the thread if you want to.
Thanks for your help!
Hello guys.
I made an indicator from KST Indicator, which consists on the sustraction of KST minus its 9 period EMA.
The code is very simple, but as I have 0 idea of programming, I had to make from looking at other indicators code.
I finally made the indicator as I wished but there is one problem with the realtime/forward plotting, as you will see inthe following screenshots.
If chart is updated, the indicator works correctly>
Ive checked the code a ton of times but I have no idea of what it could be. Can anyone give me a help on this??? Thank you very much :)
Here is the code;
When you resize your arrays you are adding fee cells to the wrong end . . . print the first few cell values ( 0 to 5 ) before and after the resize and see for yourself.
Try this . . . let me know either way, if it's still wrong please be very specific about what is wrong.
You should also comment out these lines . . .
if (KSTXBuf[i]>KSTXBuf[i-1]) { KSTXBufUp[i] = KSTXBuf[i]; // KSTXBufDown[i] = EMPTY_VALUE; // comment out or remove if (KSTXBuf[i-1]<KSTXBuf[i-2]) KSTXBufUp[i-1]=KSTXBuf[i-1]; } if (KSTXBuf[i]<KSTXBuf[i-1]) { KSTXBufDown[i] = KSTXBuf[i]; // KSTXBufUp[i] = EMPTY_VALUE; // comment out or remove if (KSTXBuf[i-1]>KSTXBuf[i-2]) KSTXBufDown[i-1]=KSTXBuf[i-1]; }
Allright, im taking a look thru the code while some candles get completed to see if it works. I apologize for my limited programming knowledge; as I want to understand what the solution is and learn from it, i was checking the code you corrected and I was wondering what are these lines you added:
Print("Pre resize: ROC1Buf - ", ROC1Buf[0], " ", ROC1Buf[1], " ", ROC1Buf[2], " ", ROC1Buf[3], " ", ROC1Buf[4], " ", ROC1Buf[5], " ", ROC1Buf[6] );
Print("Post resize: ROC1Buf - ", ROC1Buf[0], " ", ROC1Buf[1], " ", ROC1Buf[2], " ", ROC1Buf[3], " ", ROC1Buf[4], " ", ROC1Buf[5], " ", ROC1Buf[6] );
and
if(limit > 1) Print("Limit = ", limit);
Ok, printing seems to be perfect now, theres only a tiny issue, which is that red line gets printed below green line in forward plotting
Allright, im taking a look thru the code while some candles get completed to see if it works. I apologize for my limited programming knowledge; as I want to understand what the solution is and learn from it, i was checking the code you corrected and I was wondering what are these lines you added:
and
Those Prints are in there for debugging reasons, look at the experts tab . . .
What exactly do you mean by . . .
. . . red line gets printed below green line in forward plotting
Ok, yes you are right, im looking at it. What I mean by that is when indicator is plotted in real time, green line is always on top; while in the past candles, they are not overlapped. If chart us updated, it gets solved, but that leaves me at the same starting point, which is the need to update the chart very frequently (right button, refresh). In the screenshot I attached before you can check that plotting issue between the indicator boxes 2 and 4.
Edit; in fact refreshing actually does nothing, green is all the time on top.
Edit2; I removed comment bars on both up and down KSTXBufUp[i] = EMPTY_VALUE; lines, now green and red are plotted fine.
Edit3; definitely the problem is this empty_value introduction in the array which causes the problem in the indicator, after compiling with that line active again the same initial wrong behaviour is present. But without it, it doesnt get plotted with red/green correctly...
hi thedasn,
can you tell me the name or even better give me a link of the indicator that paints the gray bars at the bottom of chart 0, it writes Spread 1 Point candle 00:01.
Thanks in beforehand,
Gooly
hi gooly,
I will share with you, here you have the indicators requested, both candle clock and spread plotter.
The grey bars are the default tick volume that comes with mt4.
Enjoy

- 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 guys.
I made an indicator from KST Indicator, which consists on the sustraction of KST minus its 9 period EMA.
The code is very simple, but as I have 0 idea of programming, I had to make from looking at other indicators code.
I finally made the indicator as I wished but there is one problem with the realtime/forward plotting, as you will see inthe following screenshots.
If chart is updated, the indicator works correctly>
Ive checked the code a ton of times but I have no idea of what it could be. Can anyone give me a help on this??? Thank you very much :)
Here is the code;