@mohamed.gad, some observations.
At first sight, something seemed wrong to me: if I plot recent data for SPY vs. QQQ I expect to see the scatter points in an uptrend from lower left corner to the upper right one. But maybe you actually prefer to see them as you have done in your code (a parameter to choose the way it is presented would be a nice touch).
Your plot also overlaps the Y-axis; to avoid it you should use:
// pxwidth = Status( "pxwidth" ); // pane width
pxWidth = Status( "pxchartwidth" ); // chart width excluding Y axis area
Additionally, one of the lines you removed from your original code is still needed to properly refresh the chart when the Y-scale changes (panning the chart), if you are working with GfxSetCoordsMode(0), that is the default mode.
Add to the end of the formula:
RequestTimedRefresh( 0.25 );
(to set it lower than a second you need to enable it in the registry).
As an alternative, as was suggested by @fxshrat, maybe you want to experiment a bit using GfxSetCoordsMode(2); as a side effect this mode will also automatically resize/scale your plot circles when zooming.
Re the custom X-axis, here are some hints for a possible approach.
As a first step, you have to figure out the appropriate scale price unit (personally I select it from 0.05, 0.25, 0.50, 1, 2.5, 5, 10, 25, 50, 100).
You can derive it evaluating how large is pxWidth versus the width of the largest single price text representation (add some extra space to ensure that numbers are sufficiently spaced apart). The GfxGetTextWidth() will be useful in this case (use it sparingly since it is slow).
For instance, here are 3 different stocks custom X-axes:
Then, to actually plot the axis simply use a loop calculating the coordinates for the GfxTextOut( priceStr, x, y) function, starting with the x coordinate corresponding to the first price that is a multiple of the scale unit price, then increasing it by the such unit until you reach the maximum price in your range.
Obviously, the y coordinates in this loop are always the same.
(If you want to keep your plot as per your posted code, then apply the logic accordingly to the direction of your prices).
You can improve the X-axis appearance by adding the small vertical lines corresponding to each x point and centering the text around it. Skip also any text that will be clipped at left or may overwrite the Y-axis.
To begin experimenting you can simply start setting your X-axis price "unit" at 1.00 and try to do the loop from Floor(x min visible price) to Ceil(x max visible price).
In such a case you need to figure out how to avoid overlapping prices in the X-axis (skip them). When you have the basic loop working, try to do it properly using a pre-calculated price unit "correctly sized".
Work on it until you get it right. Happy coding!