Metastock chart scaling formula language - help please
I should like some help with my scaling code. So it always starts at zero %.
The aim of this code is to display a price percentage on the LHS (left hand side) of a price chart. This is my code.
{ 1. Define base price at bar 2 (first price point) }
startp:= ValueWhen(1, Cum(1) = 2, C);
{ 2. Calculate % change relative to the initial price 'startp' }
Ypct:= 100*(C - startp) / startp;
{ 3. Force bar 1 to plot 0, and evaluate 'y' from bar 2 onward }
If(Cum(1) >= 2, Ypct,0);
The chart looks like this. The timeline extends from 2008 to 2026.
You can see the chart begins at 0%, this is how I want to view it.
However when I zoom in the timescale, the chart now starts at Dec 2025 but the scale still refers to the 2008 start point. I need the LHS scale to refresh and start at 0%.
I assumed formula chart numbering would begin at bar 1 based on what is visible in a chart. All advice and comments would be gratefully appreciated. Thank you.