You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
For security reasons, work with files is strictly controlled in the MQL5 language. Files with which file operations are conducted using MQL5 means cannot be outside the file sandbox.
There are two directories (with subdirectories) in which working files can be located:
There is a program method to obtain names of these catalogs using the TerminalInfoString() function, using the ENUM_TERMINAL_INFO_STRING enumeration:
This is what i get:
Maybe it's time to use your imagination ?
Use CCanvas class and it will work. I dont understand why you use this native functions which blow up the code instead of using the classes. Its three lines of code to display your bitmap, not 300.
I ve uploaded a modified version of CCanvas longer time ago. With this you can also compile your image as resource and display it.
And by the way, buffers like these are only displayed after a chart-update.
It's actually the way around, displaying a bitmap take one line in native code but 300 in CCanvas include files included.
So nice try but nope.
And i had told the OP that he could use resources some posts ago but he didn't pick up on it.
same... I created another new mini example:
int OnInit() {
ObjectCreate(0, "test", OBJ_BITMAP,0, TimeCurrent(), 1.047);
ObjectSetString(0,"test",OBJPROP_BMPFILE,0,"..\\Images\euro.bmp");
Print("Last Error:", GetLastError());
return(0);
}
void OnTick() {
}
here I also tried differente pathes. The object is placed by TimeCurrent and Price as can be seen in the screenshot:
changing the function to:
int OnInit() {
string file="\\Images\\dollar.bmp";
ObjectCreate(0, "test", OBJ_BITMAP,0, TimeCurrent(), 1.047);
ObjectSetString(0,"test",OBJPROP_BMPFILE,0,file);
Print("Last Error:", GetLastError());
return(0);
}
void OnTick() {
}
has no effect either. Might be a bug? cannot see what's wrong..
ObjectCreate(0,"test",OBJ_BITMAP_LABEL,0,0,0);
ObjectSetString(0,"test",OBJPROP_BMPFILE,0,"\\Images\\euro.bmp");
ObjectSetInteger(0,"test",OBJPROP_XDISTANCE,265);
ObjectSetInteger(0,"test",OBJPROP_YDISTANCE,175);
ObjectSetInteger(0,"test",OBJPROP_CORNER,0);
ObjectSetInteger(0,"test",OBJPROP_BACK,true);
Use the </> code button to insert your code.
Have the same problem. The script compiles, resource is accepted, you just can't see anything on chart.
Then i tried with another bitmap, same location and i get error "unsupported image type".
What's the secret here ?
I could solve it by playing around with width and height parameter:
In my case i used a slightly lower width and height as the imagsize given in windows paint and then the bitmap shown on chart.