Strategy tester cannot find custom images

 

Hi, everybody. I created an indicator with custom images drawn as OBJ_BITMAP_LABEL objects. I placed the images in Images folder inside the MQL5 folder.

When I try my indicator in the strategy tester only empty squares are appearing although I created an equal Images folder inside the MQL5 folder of the strategy tester Agent.

Could some help me? Thanks

 
What code are you using to read your images ?
 

This one

 angle_icon="\\Images\\M5+"+IntegerToString(angle1)+".bmp";


       ObjectCreate(0,"Direction_M5",OBJ_BITMAP_LABEL,0,0,0);
   ObjectSetString(0,"Direction_M5",OBJPROP_BMPFILE,0,angle_icon);
   ObjectSetString(0,"Direction_M5",OBJPROP_BMPFILE,1,angle_icon);
   ObjectSetInteger(0,"Direction_M5",OBJPROP_XDISTANCE,1500);
   ObjectSetInteger(0,"Direction_M5",OBJPROP_YDISTANCE,250);
   ObjectSetInteger(0,"Direction_M5",OBJPROP_XSIZE,90);
  ObjectSetInteger(0,"Direction_M5",OBJPROP_YSIZE,90);
   ObjectSetInteger(0,"Direction_M5",OBJPROP_XOFFSET,0);
   ObjectSetInteger(0,"Direction_M5",OBJPROP_YOFFSET,0);
   ObjectSetInteger(0,"Direction_M5",OBJPROP_STATE,1);
   ObjectSetInteger(0,"Direction_M5",OBJPROP_CORNER,CORNER_LEFT_UPPER);
   ObjectSetInteger(0,"Direction_M5",OBJPROP_ANCHOR,ANCHOR_LEFT_UPPER);

that creates a string like "\\Images\\M5+20.bmp" or similar.

I forgot to say that the indicator is working fine on live

 
danerstizz #:

This one

that creates a string like "\\Images\\M5+20.bmp" or similar.

I forgot to say that the indicator is working fine on live

You should better embed your images as resource. Please check the documentation.

You can also try #property tester_file.

Documentation on MQL5: MQL5 programs / Resources
Documentation on MQL5: MQL5 programs / Resources
  • www.mql5.com
Resources - MQL5 programs - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Ok, I'll try it and let you know. Thanks
 
Alain Verleyen #:

You should better embed your images as resource. Please check the documentation.

You can also try #property tester_file.

Hi, Alain. I tried adding this lines but it doesn't work. Do you have other ideas?
#property tester_file "\\Images\\M5-0.bmp";
#property tester_file "\\Images\\M5-10.bmp";
#property tester_file "\\Images\\M5-20.bmp";
#property tester_file "\\Images\\M5-30.bmp";
#property tester_file "\\Images\\M5-40.bmp";
#property tester_file "\\Images\\M5-50.bmp";
#property tester_file "\\Images\\M5-60.bmp";
#property tester_file "\\Images\\M5-70.bmp";
#property tester_file "\\Images\\M5-80.bmp";
#property tester_file "\\Images\\M5+10.bmp";
#property tester_file "\\Images\\M5+20.bmp";
#property tester_file "\\Images\\M5+30.bmp";
#property tester_file "\\Images\\M5+40.bmp";
#property tester_file "\\Images\\M5+50.bmp";
#property tester_file "\\Images\\M5+60.bmp";
#property tester_file "\\Images\\M5+70.bmp";
#property tester_file "\\Images\\M5+80.bmp";
 
danerstizz #:
Hi, Alain. I tried adding this lines but it doesn't work. Do you have other ideas?

Forum on trading, automated trading systems and testing trading strategies

Strategy tester cannot find custom images

Alain Verleyen, 2023.04.13 17:54

You should better embed your images as resource. Please check the documentation.

You can also try #property tester_file.


 
Alain Verleyen #:

As you said I've just tried this code but the strategy tester doesn't find the images.

#resource  "\\Images\\M5-0.bmp";
#resource  "\\Images\\M5-10.bmp";
#resource  "\\Images\\M5-20.bmp";
#resource  "\\Images\\M5-30.bmp";
#resource  "\\Images\\M5-40.bmp";
#resource  "\\Images\\M5-50.bmp";
#resource  "\\Images\\M5-60.bmp";
#resource  "\\Images\\M5-70.bmp";
#resource  "\\Images\\M5-80.bmp";
#resource  "\\Images\\M5+10.bmp";
#resource  "\\Images\\M5+20.bmp";
#resource  "\\Images\\M5+30.bmp";
#resource  "\\Images\\M5+40.bmp";
#resource  "\\Images\\M5+50.bmp";
#resource  "\\Images\\M5+60.bmp";
#resource  "\\Images\\M5+70.bmp";
#resource  "\\Images\\M5+80.bmp";