First, can you clarify what's currently happening (which is not what you want)?
btw this is MQL4 code. You have to specify if you want the indicator to work on MT4 or MT5.
try this
Remove these lines where they are:
arrup[i] = EMPTY_VALUE; arrdwn[i] = EMPTY_VALUE;
then modify the code like so:
if(nexttrend==1) { maxlowprice=MathMax(lowprice_i,maxlowprice); if(highma<maxlowprice && Close[i]<Low[i+1]) { trend[i]=1.0; nexttrend=0; minhighprice=highprice_i; arrup[i] = 1; arrdwn[i] = EMPTY_VALUE; if (alertsOn) { if (arrup[i] != EMPTY_VALUE) doAlert(i,"up"); } } } else if(nexttrend==0) { minhighprice=MathMin(highprice_i,minhighprice); if(lowma>minhighprice && Close[i]>High[i+1]) { trend[i]=0.0; nexttrend=1; maxlowprice=lowprice_i; arrup[i] = EMPTY_VALUE; arrdwn[i] = 1; if (alertsOn) { if (arrdwn[i] != EMPTY_VALUE) doAlert(i,"down"); } } }
I understand you want it to be like this:
if(nexttrend) { maxlowprice = MathMax(lowprice_i, maxlowprice); if(highma < maxlowprice && close[i] < low[i + 1]) { trend[i] = 1.0; nexttrend = false; minhighprice = highprice_i; arrup[i] = i; } else{ arrup[i] = EMPTY_VALUE; } } else if(!nexttrend) { minhighprice = MathMin(highprice_i, minhighprice); if(lowma > minhighprice && close[i] > high[i + 1]) { trend[i] = 0.0; nexttrend = true; maxlowprice = lowprice_i; arrdwn[i] = i; } else{ arrdwn[i] = EMPTY_VALUE; } }
I did this, but unfortunately the arrow plots go missing when you change timeframes, because the buffers seem to be unstable, and I couldn't fix it
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Dear Friends,
The indicator code is buy Arrow and sell Arrow main signal.
Need to modification for after buy arrow signal then next all candles show the buy Arrow (Up Arrow).
if main signal sell Arrow created by the indicator next all candles show the sell Arrow (Down Arrow).
With Alert for all candle.
Please rewrite me the code.
Thank you