Discussion of article "How to create 3D graphics using DirectX in MetaTrader 5" - page 4

 
Mahrukh Aleem:

I have a suggestion if you want to promote gaming or graphical application or one screen application.


Make a switch with mt4/mt5 application like

-singleappmode windowed templatename.tpl theea.ex4/ex5 

-singleappmode fullscreen templatename.tpl theea.ex4/ex5 


When someone runs application with switch metatrader will just open one chart apply template and attach the EA. All other things will be hidden only shown if EA allows using a property or function.

Like show controls, show menubar etc. Or it could be showdefaults.

In this way MetaTrader can become serious graphical application or single ea  user application.


I know it could be hard to make or require some company level decisions , just my suggestion to improve meta trader.

3d is nice feature, but I would prefer a lot to have all basic stuff to be fixed in priority, and there are a lot believe me.

Developing game inside a trading platform, really ?

 
Alain Verleyen:

3d is nice feature, but I would prefer a lot to have all basic stuff to be fixed in priority, and there are a lot believe me.

Developing game inside a trading platform, really ?

It could be a game or a very well styled trading robot with fully customized gui.

 
It’s nice 
 
Wow, I didn't know you could do that in mql5. I have modelled in 3d for other purposes but I didn't know you could do it here too.
 

12 hours of mastering and the result:



3D works well, but it is not easy to master.

 

The same question - and WHY do we need 3D graphics in the trading terminal??
Or are these "pass-hacks from developers" = a la just to make fun of us?! :)

Who saw the TOLK in 3D-graphics ???

 

Sir.

the code in this article cnn not run ! Please check and help me .

for Canva.mql code: I add some Print(...) code for trace error, see bellow.

line 328.

bool CCanvas::CreateBitmapLabel(const long chart_id,const int subwin,const string name,
                                const int x,const int y,const int width,const int height,
                                ENUM_COLOR_FORMAT clrfmt)
  {
//--- create canvas
       Print("At CCanvas Create BitmapLabel 1  ",width,"  ",name,"   ",height,"  ",clrfmt);   //I add
       bool xx= Create(name,width,height,clrfmt);     
       Print("CCanvas Create return  ",xx,"   ",GetLastError());   //I add
 // if(Create(name,width,height,clrfmt)) // I change
   if (xx)
     {
       Print("CCanvas Create  2  ",chart_id,"  ",name,"   ",subwin);
..................

for Canva.mql code: I add some Print(....) code for trace error, see bellow: line 328.

xx= Create(name,width,height,clrfmt);    will call function bellow:

see bellow: line 328: for Canva.mql code: line 250.

bool CCanvas::Create(const string name,const int width,const int height,ENUM_COLOR_FORMAT clrfmt)
  {
   Destroy();
//--- prepare data array
   if(width>0 && height>0 && ArrayResize(m_pixels,width*height)>0)
     {
      //--- generate resource name
      m_rcname="::"+name+(string)ChartID()+(string)(GetTickCount()+MathRand());
      
      //--- initialize data with zeros
      ArrayInitialize(m_pixels,0);
      //--- create dynamic resource
       Print("Before CCanvas ResourceCreate 0  ",m_rcname);         //I add
      if(ResourceCreate(m_rcname,m_pixels,width,height,0,0,0,clrfmt))
        {

         //--- successfully created
         //--- complete initialization
         m_width =width;
         m_height=height;
         m_format=clrfmt;
         //--- succeed
       Print("then CCanvas ResourceCreate OK  ",m_rcname);     //I add
         return(true);
        }
     }
.............................


For sample 3D-surface.mq5

line 40: Run 3D-Surface.mq5, received.

   //| Create & nbsp; &nbsp nbsp;   &nbsp
   //+------------------------------------------------------------------+
   virtual bool      Create(const int width,const int height)
     {
      //--- save canvas dimensions
      m_width=width;
      m_height=height;
      //--- Reset input data
      m_mouse_x=m_mouse_y=-1;
      //--- Set default parameters for the camera
      m_camera_distance=10.0 f;
      m_camera_angles.x=DX_PI_DIV6;
      m_camera_angles.y=DX_PI_DIV3;
      //--- create a canvas to render a 3D scene
      ResetLastError();
      if(!m_canvas.CreateBitmapLabel("3D Surface",0,0,m_width,m_height,COLOR_FORMAT_ARGB_NORMALIZE))
       { 
         Print("CreateBitmapLabel fail 3D surface ?");   // I add this line
         Print("Error creating canvas: ",GetLastError());
         return(false);
         }
..........................


Run 3D-Surface.mq5, received.

2023.05.05 11:32:46.180 3 D_Surface (EURUSD,M1)  At CCanvas Create BitmapLabel 1  604  3 D Surface   392  2
2023.05.05 11:32:46.180 3 D_Surface (EURUSD,M1)  Before CCanvas ResourceCreate 0  ::3 D Surface1332772457869319469285704
2023.05.05 11:32:46.180 3 D_Surface (EURUSD,M1)  then CCanvas ResourceCreate OK  ::3 D Surface1332772457869319469285704
2023.05.05 11:32:46.185 3 D_Surface (EURUSD,M1)   CCanvas Create return  false   5151
2023.05.05 11:32:46.185 3 D_Surface (EURUSD,M1)  CreateBitmapLabel fail 3 D surface ?
2023.05.05 11:32:46.185 3 D_Surface (EURUSD,M1)  Error creating canvas: 5151
then CCanvas ResourceCreate OK 
BUR BUT But....

    
CCanvas Create return  false   5151

What's wrong?

What is 5151 ?

 

my display adapter is Nivada FX 1700--- an old product. only support feture-level 10.0


So use DXcpl.exe to set Force WRAP for MT , then all run OK.

 

To demonstrate the capabilities of the language, not bad.

But it is hardly useful for trading, having thought where I can use it for trading, but nothing came to my mind.

For demonstration it is better to write an Expert Advisor template with all the checks of correct opening of a pose, setting an order, modification, deletion, closing, etc., for further sending for validation, without errors.

My point is, I wrote an Expert Advisor on mt5, it trades in the terminal without errors and problems.

I sent it for validation, there are a lot of errors, for each action I wrote about 5 checks, using my own and from the

What checks should a trading robot pass before publishing in the Market?

and it was useless, I tortured myself for a month, still a lot of errors.

I had to spit, it is not for nothing that it is hard to switch to mt5, I have no such problems with mt4.

The template will definitely be useful.

Or give me a link to a working template, I did not find a good one.

Good luck to everyone!

Какие проверки должен пройти торговый робот перед публикацией в Маркете
Какие проверки должен пройти торговый робот перед публикацией в Маркете
  • www.mql5.com
Все продукты Маркета перед публикацией проходят обязательную предварительную проверку для обеспечения единого стандарта качества. В этой статье мы расскажем о наиболее частых ошибках, которые допускают разработчики в своих технических индикаторах и торговых роботах. А также покажем как самостоятельно проверить свой продукт перед отправкой в Маркет.
 
Anatoliy Lukanin #:

give me a link to a working template, I can't find a good one.

https://www.mql5.com/ru/forum/93352/page78#comment_48296338