When in doubt, think. Before you add an arrow, see if there is already one on the previous bar.
I already add the global variable "Count_signal"
then if signal appear, it's auto counting +1 & mix with condition same like that, but it do not work.
int Count_signal=0; ... int start() ... //SELL signal if (MACDLineBuffer[i]<SignalLineBuffer[i]&& Count_signal<1) { SignalDown[i]= SignalLineBuffer[i] ; Count_signal++; } //BUY signal if (MACDLineBuffer[i]>SignalLineBuffer[i]&& Count_signal<1) { SignalUp[i]= MACDLineBuffer[i] ; Count_signal++; }
I think I could check signal on the last bar i+1
But it still do not work well,
//SELL signal if (MACDLineBuffer[i]<SignalLineBuffer[i]) { // check signal on i+1 if (SignalDown[i + 1] != EMPTY_VALUE ) continue; else SignalDown[i]= SignalLineBuffer[i] ; } //BUY signal if (MACDLineBuffer[i]>SignalLineBuffer[i]) { if (SignalUp[i + 1] != EMPTY_VALUE ) continue; else SignalUp[i]= MACDLineBuffer[i] ; }
Dear coder,
I am writing an indicator (checking signal from MACD + MACD of highger timflame)
But I could not find the method only add one arrow on the first bar when the signal appear
So the chart as image below.
Could you please check and give me some advice to revise my code.
Thank you so much.
Your indicator looks into the future in the historic bars.
For instance, your main TF is on M1 and you are using M15 .
For any bar that has both M1 and M15 concluded in the past , it's form represents the final closed state .
But you are requesting it earlier.
For instance at 15:00 you are requesting the M15 bar which concludes at 15:14:59 and this is the shape it has in the history.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear coder,
I am writing an indicator (checking signal from MACD + MACD of highger timflame)
But I could not find the method only add one arrow on the first bar when the signal appear
So the chart as image below.
Could you please check and give me some advice to revise my code.
Thank you so much.