ChartHeightInPixelsSet in MQL5 does not work
ChartHeightInPixelsSet in MQL5 does not work
Loading saved threads...
jjo mmax · External communityPost link
External question — Stack Overflow Stack Exchange
Author: jjo mmax
Original post: https://stackoverflow.com/questions/79635177
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I have written the following codes in my Metaeditor, but it does not work.
void OnInit()
{
ChartHeightInPixelsSet(500, 0, 1);
}
bool ChartHeightInPixelsSet(const int value,const long chart_ID=0,const int sub_window=0)
{
//--- reset the error value
ResetLastError();
//--- set property value
if(!ChartSetInteger(chart_ID,CHART_HEIGHT_IN_PIXELS,sub_window,value))
{
//--- display the error message in Experts journal
Print(__FUNCTION__+", Error Code = ",GetLastError());
return(false);
}
//--- successful execution
return(true);
}
I have created a new Expert in metaeditor and the function ChartHeightInPixelsGet works but the function ChartHeightInPixelsSet does not work. Many times I tried but I did not succeed. I also tried it by "void OnStart()" and also updated my metatrader to 2025 but it did not work.
Is this the answer : "Some functions in Metatrader does not work" If this is the answer, How can we know which functions works correctly? (Can someone help me?)
Quote
Report
Forex Coder · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Forex Coder
Original post: https://stackoverflow.com/a/79645916
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
int size=0,step=1;
int OnInit()
{
size=0; step=10;
EventSetMillisecondTimer(44);
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason) { }
void OnTick() {
}
void OnTimer()
{
if(ChartGetInteger(0,CHART_WINDOWS_TOTAL,0)>1)
{
size+=step;
if(size>100){step=-10;}
if(size<0){step=10;}
ChartSetInteger(0,CHART_HEIGHT_IN_PIXELS,1,size);
ChartRedraw(0);
}
}
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External answer — Stack Overflow Stack Exchange Author: Forex Coder Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/a/79645916 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. int size=0,step=1; int OnInit() { size=0; step=10; EventSetMillisecondTimer(44); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { } void OnTick() { } void OnTimer() { if(ChartGetInteger(0,CHART_WINDOWS_TOTAL,0)>1) { size+=step; if(size>100){step=-10;} if(size<0){step=10;} ChartSetInteger(0,CHART_HEIGHT_IN_PIXELS,1,size); ChartRedraw(0); } }
Checking account access…