# calculate the price scale range ( Max-Min)

Moderator
10536

8

Gentlemen:,

I am newbie , 3 weeks in the making of trading  LOL.

I need a full script that will calculate the price scale range ( Max-Min), then it divides it by the pixel count of the grid then display it in chart window somewhere, and to be dynamic of course if i change scale or visible area,......

I tried to create a script for it, but when I debug it, the chart_price_min display 108 ?????

I don't know what is wrong

:(

16808

sherinhamad: I don't know what is wrong
Neither can we; we can't see your broken code; our crystal balls are broken; we're not a mind readers.
1364

Gentlemen:,

I am newbie , 3 weeks in the making of trading  LOL.

I need a full script that will calculate the price scale range ( Max-Min), then it divides it by the pixel count of the grid then display it in chart window somewhere, and to be dynamic of course if i change scale or visible area,......

I tried to create a script for it, but when I debug it, the chart_price_min display 108 ?????

I don't know what is wrong

:(

This won't work in debug mode because CHART_PRICE_M* returns zero in debug.

```void OnStart()
{
double max = ChartGetDouble(0,CHART_PRICE_MAX);
double min = ChartGetDouble(0,CHART_PRICE_MIN);
Print("max= ",max," min= ",min);
if(min > 0 && max > 0)
{
int    height = (int)ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS);
int    yBid = int(((max-Bid)/(max-min))*(double)height);
Print("height = ",height," yBid= ",yBid);
}
}```