almostprofitable101 wrote: Wed Jan 29, 2025 9:20 am
hello again i am trying to add alerts to an indicator but im getting 1 error any help please

(i added this section of code from another indicator so not sure if its correct method for alerts

)
In the alert function, where the
[i]
and
[i+1]
try changing it to
[whichBar]
and
[whichBar+1]
. Also maybe change
Code: Select all
for(i=limit;i>=0;i--)
{
bufferUP[i-1]=EMPTY_VALUE; bufferDN[i-1]=EMPTY_VALUE;
if(Down[i]!=0 && ExtMapBuffer2[i]>0 && jrhi[i]!=EMPTY_VALUE && jrhi[i]!=0 && (Up[i+1]!=0 || ExtMapBuffer1[i+1]>0 || (jrlo[i+1]!=EMPTY_VALUE && jrlo[i+1]!=0)))
{
bufferUP[i-1]=Low[i-1]-0.5*iATR(_Symbol,0,5,i);
}
else if(Up[i]!=0 && ExtMapBuffer1[i]>0 && jrlo[i]!=EMPTY_VALUE && jrlo[i]!=0 && (Down[i+1]!=0 || ExtMapBuffer2[i+1]>0 || (jrhi[i+1]!=EMPTY_VALUE && jrhi[i+1]!=0)))
{
bufferDN[i-1]=High[i-1]+0.5*iATR(_Symbol,0,5,i);
}
}
to
Code: Select all
for(i=limit;i>=0;i--)
{
bufferUP[i]=EMPTY_VALUE; bufferDN[i]=EMPTY_VALUE;
if(Down[i]!=0 && ExtMapBuffer2[i]>0 && jrhi[i]!=EMPTY_VALUE && jrhi[i]!=0 && (Up[i+1]!=0 || ExtMapBuffer1[i+1]>0 || (jrlo[i+1]!=EMPTY_VALUE && jrlo[i+1]!=0)))
{
bufferUP[i]=Low[i]-0.5*iATR(_Symbol,0,5,i);
}
else if(Up[i]!=0 && ExtMapBuffer1[i]>0 && jrlo[i]!=EMPTY_VALUE && jrlo[i]!=0 && (Down[i+1]!=0 || ExtMapBuffer2[i+1]>0 || (jrhi[i+1]!=EMPTY_VALUE && jrhi[i+1]!=0)))
{
bufferDN[i]=High[i]+0.5*iATR(_Symbol,0,5,i);
}
}