@kv_maligi, first of all, I remember you that when posting some code, it is mandatory to use the code tags as explained in the [Enter the AFL code properly] (How to use this site) section of "How to use this site".
The formula you posted is a little mess (as it usually happens when doing paste & copy from multiple sources).
It needs a proper cleanup removing duplications, unneeded sections, replacing the repeated constant values with variables, or actually used parameters, etc.), but I leave that to you as a learning exercise.
Anyway, the part that you would fix, as per your topic title, are the calls to the PlotShapes() function.
If you study the documentation closely, you will see that there are additional parameters (yposition
and the associated offset
) that allows you to decide precisely where to position in the y-axis the arrows (in your case using the r
variable calculated in the r = RSI(periods);
line.
Moreover, you'll probably need to tale a look at the ExRem() function to remove excessive signals (to avoid drawing multiple sequences of arrows) or alternatively use the Cross() function to get fewer signals from the start.