Price scale: Fixed amount of pips per bar

 

how can i make that the price scale always has 50 pips / 500 points distance per bar? (and the bars should keep same size as always)

((i've tried every option in chart properties but nothing worked))


what i found so far: but i have no clue where and how to set the value.

https://www.mql5.com/en/docs/constants/chartconstants/charts_samples

//+------------------------------------------------------------------+
//| Checks if the "points per bar" chart scaling mode is enabled     |
//+------------------------------------------------------------------+
bool ChartScalePerBarGet(bool &result,const long chart_ID=0)
  {
//--- prepare the variable to get the property value
   long value;
//--- reset the error value
   ResetLastError();
//--- receive the property value
   if(!ChartGetInteger(chart_ID,CHART_SCALE_PT_PER_BAR,0,value))
     {
      //--- display the error message in Experts journal
      Print(__FUNCTION__+", Error Code = ",GetLastError());
      return(false);
     }
//--- store the value of the chart property in memory
   result=value;
//--- successful execution
   return(true);
  }
//+------------------------------------------------------------------+
//| Enables/disables the "points per bar" chart scaling mode         |
//+------------------------------------------------------------------+
bool ChartScalePerBarSet(const bool value,const long chart_ID=0)
  {
//--- reset the error value
   ResetLastError();
//--- set property value
   if(!ChartSetInteger(chart_ID,CHART_SCALE_PT_PER_BAR,0,value))
     {
      //--- display the error message in Experts journal
      Print(__FUNCTION__+", Error Code = ",GetLastError());
      return(false);
     }
//--- successful execution
   return(true);
  }

Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Examples of Working with the Chart
Documentation on MQL5: Constants, Enumerations and Structures / Chart Constants / Examples of Working with the Chart
  • www.mql5.com
This section contains examples of working with chart properties. One or two complete functions are displayed for each property. These functions allow setting/receiving the value of the property. These functions can be used "as is" in custom mql5 applications. The screenshot below demonstrates the graphic panel illustrating how changing of the...
Files:
price_scale.png  87 kb
 
everyone clueless?
 


On this topic, can I just comment that MT5 (as of b1880, JUl 2018) has some serious flaws/bugs in trying to control the scale of #points/bar.


Consider that there is a "Scale fix" setting, which if checked means that the Y-axis scaling is fixed.  You can pan around but the bars stay the same height.  The #pips shown in, say, an inch, is arbitrary, and varies by click-and-drag of the Y-axis scale.  In other words, the scale is not yet fixed, and this is ok, so far.

Next, consider that when you click on "Scale fix one to one", that it ALSO force selects the "Scale fix" at the same time.   This is fine, and I expect it to occur.  My scale is truly "fixed", and it is "one to one".   Both checkboxes make sense together.


However, in MT5, the "one to one" is 1 point(=1pipette) to 1 bar.   With typical H1 forex charts, this is a useless scale, zoomed-in far too close!!   In MT4, however, it is interpreted as 1-true-pip(=10pipettes) to 1 bar.   This is usually a good scale!


Now, consider that MT5 has a new "Scale points per bar" checkbox, BUT THIS IS BUGGY AND USELESS AS IMPLEMENTED!


I truly want a fixed scale, but I don't prefer the one(point)-to-one(bar) scale, rather I want a custom scale.

I should be able to enter "10" for "Points per bar", and it ought to then mean that a 45-degree line drawn on the chart will therefore be 10points up, in the span on 1 bar.   Or same slope, 100 points in 10 bars.

BUG #1:  Why does it turn off "Scale fix"??   I still want a "Scale fix" on!  I'm merely choosing a custom scale, different from the "one to one" choice.  

BUG #2:  The height of my chart window *should not* matter!    If I drag it taller, I should simply see a larger portion of the Y-axis prices.  The scale is supposed to be "10 Points per bar", always, regardless of chart height, yet it is obviously changing the scale as I change height.

BUG #3:  The scaling is simply wrong!   Suppose I use "10", then draw a trendline 100 pipettes rise in 10 bars.  It should be exactly a 45-degree line, but it's not!   The angle of the line varies, depending on the vertical height of my chart window.      (MT4 and MT5 work fine for the one-to-one scale.  MT5 is broken for the new custom Points per bar scaling!).


In other words, when I enter my custom value of 10 for Points per bar, then I should be able to draw a 45 degree line anywhere on the chart, whether zoomed-in close, or zoomed-out, and know that the slope of that 45-degree line is always 10pipettes/bar.   This isn't working properly.   Please fix MT5!!

Reason: