Can anyone explainme why trying to force scale to 1 inside an indicator I get the error 4210? Here the code in the init ():
long scala;
ResetLastError();
bool result;
result= ChartGetInteger(ChartID(),CHART_SCALE_PT_PER_BAR,0,scala);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala =",scala);
result= ChartSetInteger(ChartID(),CHART_SCALE_PT_PER_BAR,0,1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
double verificascala1to1 ;
result= ChartGetDouble(ChartID(),CHART_POINTS_PER_BAR,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
if (verificascala1to1!=1) result= ChartSetDouble(ChartID(),CHART_POINTS_PER_BAR,1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
result= ChartGetDouble(ChartID(),CHART_POINTS_PER_BAR,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
Looks like you are trying to use properties that are specific for metatrader 5 and do not exist in metatrader 4
Can anyone explainme why trying to force scale to 1 inside an indicator I get the error 4210? Here the code in the init ():
long scala;
ResetLastError();
bool result;
result= ChartGetInteger(ChartID(),CHART_SCALE_PT_PER_BAR,0,scala);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala =",scala);
result= ChartSetInteger(ChartID(),CHART_SCALE_PT_PER_BAR,0,1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
double verificascala1to1 ;
result= ChartGetDouble(ChartID(),CHART_POINTS_PER_BAR,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
if (verificascala1to1!=1) result= ChartSetDouble(ChartID(),CHART_POINTS_PER_BAR,1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
result= ChartGetDouble(ChartID(),CHART_POINTS_PER_BAR,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
Looks like you are trying to use properties that are specific for metatrader 5 and do not exist in metatrader 4 (the error is set even when you try to get the value and if you try to use some other value than 1
Looks like you are trying to use properties that are specific for metatrader 5 and do not exist in metatrader 4 (the error is set even when you try to get the value and if you try to use some other value than 1
Thak you Madlen, but is there a way to set scale to 1 in MT4? The online help tell to setthe property CHART_POINTS_PER_BAR & CHART_SCALE_PT_PER_BAR
Thak you Madlen, but is there a way to set scale to 1 in MT4? The online help tell to setthe property CHART_POINTS_PER_BAR & CHART_SCALE_PT_PER_BAR
It is either an error in their documentation (that they included it in the metatrader 4 help file simply by error) or a run time error (bug in the new metatrader 4). I used slightly modified code of yours to check, and all 4 steps when you refer those properties are returning the same error regardless of the value that is used to set those properties:
int OnInit()
{
long scala;
ResetLastError();
bool result;
result= ChartGetInteger(ChartID(),CHART_SCALE_PT_PER_BAR,0 ,scala);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala =",scala);
ResetLastError();
result= ChartSetInteger(ChartID(),CHART_SCALE_PT_PER_BAR,0 ,10);
if (result!= true) Print(__FUNCTION__+", Error Code 1 = ",GetLastError());
double verificascala1to1 ;
ResetLastError();
result= ChartGetDouble(ChartID(),CHART_POINTS_PER_BAR,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code 2 = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
ResetLastError();
if (verificascala1to1!=1) result= ChartSetDouble(ChartID(),CHART_POINTS_PER_BAR,10);
if (result!= true) Print(__FUNCTION__+", Error Code 3 = ",GetLastError());
ResetLastError();
result= ChartGetDouble(ChartID(),CHART_POINTS_PER_BAR,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code 4 = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
return(0);
}
int OnCalculate (const int rates_total, // size of input time series
const int prev_calculated, // bars handled in previous call
const datetime& time[], // Time
const double& open[], // Open
const double& high[], // High
const double& low[], // Low
const double& close[], // Close
const long& tick_volume[], // Tick Volume
const long& volume[], // Real Volume
const int& spread[] // Spread
)
{
return(0);
It' s correct, in MT4 the only way to set scale 1:1 and verifying the changing is this one:
result= ChartGetInteger(ChartID(),CHART_SCALEFIX_11,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
ResetLastError();
result= ChartSetInteger(ChartID(),CHART_SCALEFIX_11,0,1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
ResetLastError();
result= ChartGetInteger(ChartID(),CHART_SCALEFIX_11,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can anyone explainme why trying to force scale to 1 inside an indicator I get the error 4210? Here the code in the init ():
long scala;
ResetLastError();
bool result;
result= ChartGetInteger(ChartID(),CHART_SCALE_PT_PER_BAR,0,scala);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala =",scala);
result= ChartSetInteger(ChartID(),CHART_SCALE_PT_PER_BAR,0,1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
double verificascala1to1 ;
result= ChartGetDouble(ChartID(),CHART_POINTS_PER_BAR,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);
if (verificascala1to1!=1) result= ChartSetDouble(ChartID(),CHART_POINTS_PER_BAR,1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
result= ChartGetDouble(ChartID(),CHART_POINTS_PER_BAR,0,verificascala1to1);
if (result!= true) Print(__FUNCTION__+", Error Code = ",GetLastError());
Print("Scala del grafico=",verificascala1to1);