calculate the price scale range ( Max-Min)

 
Comments that do not relate to the "Please help with one trade per day code", have been moved into this topic.
 

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 


:(

 
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.
 
sherinhamad:

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);
   }
}
Reason: