How do you see Metatrader X in 2030? - page 6

 
fxsaber:

Write any data to the global can be seen in the corresponding inludes here.

OK, I haven't seen this solution.

It's not easy to figure out, you have to check

 
fxsaber:

Any data written to the global can be seen in the corresponding inludes here.

Are you aware that there is a huge world of other data besides ticks? You want the strange - write/read data of a class instance.

 
Igor Makanu:

OK, I haven't seen this solution.

It's not easy to figure out, you have to check it out.

Yes writing and reading raw data to/from the resource. Good example, thanks!

But how about my esteemed fxsaber to do the same thing with classes? Can even with defines, people promise not to go crazy )))

 
Alexey Volchanskiy:

Isn't that coke, oh, grannies.


No. Gingerbread futures.

 
Alexey Volchanskiy:

Are you aware that there is a huge world of other data besides ticks?

Forum on trading, automated trading systems and strategy testing

Do we need global terminal variables like string?

fxsaber, 2017.04.10 18:25

void OnStart()
{
  string Name = "Name";

// Записываем/считываем строки
  _GlobalVariableSet(Name, "Hello World!");
  Print(_GlobalVariableGet<string>(Name));

// Записываем/считываем простые структуры
  MqlTick Tick;
  SymbolInfoTick(_Symbol, Tick);

  _GlobalVariableSet(Name, Tick);
  Print(_GlobalVariableGet<MqlTick>(Name).time);

// Записываем/считываем массивы
  MqlTick Ticks[2];

  Ticks[0] = Tick;
  Ticks[1] = Tick;

  _GlobalVariableSet(Name, Ticks);

  MqlTick NewTicks[];

//  if (_GlobalVariableGet(Name, NewTicks)) // https://www.mql5.com/ru/forum/1111/page1868#comment_4853867
//    Print(NewTicks[1].time);

  _GlobalVariableDel(Name);
}


I want the strange - write/read data of an instance of a class.

I store data in structures, just like the developers. It's convenient and logical. So I haven't looked towards classes in this issue, even though there are no pointers to structures.

 
fxsaber:


I store data in structures, as do the developers. It is convenient and logical. Therefore, I didn't look at classes in this matter, even though there are no pointers to structures.

I built the script for checking, but I don't know how to read MqlTick array

#property strict
#include <fxsaber\TypeToBytes.mqh>        //https://www.mql5.com/ru/code/16282
#define  POSTFIX "___"

string GetName( const string Name, const int Num, const string PostFix = POSTFIX )
{
  return(Name + PostFix + (string)Num);
}

bool _GlobalVariableDel( const string Name )
{
  return(GlobalVariableDel(Name) && (GlobalVariablesDeleteAll(Name + POSTFIX) >= 0));
}

#define  GLOBAL_VARIABLE_SET(A)                                                        \
template <typename T>                                                                 \
  datetime _GlobalVariableSet( const string Name, const T A )                         \
  {                                                                                   \
    _GlobalVariableDel(Name);                                                         \
                                                                                      \
    double Array[];                                                                   \
                                                                                      \
    const datetime Res = GlobalVariableSet(Name, _ArrayCopy(Array, _R(Value).Bytes)); \
    const int Size = ArraySize(Array);                                                \
                                                                                      \
    for (int i = 0; i < Size; i++)                                                    \
      GlobalVariableSet(GetName(Name, i), Array[i]);                                  \
                                                                                      \
    return(Res);                                                                      \
  }

GLOBAL_VARIABLE_SET(Value)
GLOBAL_VARIABLE_SET(&Value)
GLOBAL_VARIABLE_SET(&Value[])

#define  GLOBAL_VARIABLE_GET(A)                                              \
  {                                                                         \
    double Array[];                                                         \
                                                                            \
    const int Amount = (int)Tmp;                                            \
    const int Size = ArrayResize(Array, Amount / sizeof(double) +           \
                                 ((Amount % sizeof(double) == 0) ? 0 : 1)); \
                                                                            \
    for (int i = 0; i < Size; i++)                                          \
      Array[i] = GlobalVariableGet(GetName(Name, i));                       \
                                                                            \
    uchar Bytes[];                                                          \
                                                                            \
    _ArrayCopy(Bytes, Array, 0, 0, Amount);                                 \
                                                                            \
    _W(A) = Bytes;                                                          \
  }

template <typename T>
const T _GlobalVariableGet( const string Name )
{
  T Res; // https://www.mql5.com/ru/forum/1111/page1869#comment_4854112

  double Tmp;

  if (GlobalVariableGet(Name, Tmp))
    GLOBAL_VARIABLE_GET(Res)

  return(Res);
}

template <typename T>
bool _GlobalVariableGet( const string Name, T &Value )
{
  double Tmp;
  const bool Res = GlobalVariableGet(Name, Tmp);

  if (Res)
    GLOBAL_VARIABLE_GET(Value)

  return(Res);
}


void OnStart()
  {
   string Name="Name";

// Записываем/считываем строки
   _GlobalVariableSet(Name,"Hello World!");
   Print(_GlobalVariableGet<string>(Name));

// Записываем/считываем простые структуры
   MqlTick Tick;
   SymbolInfoTick(_Symbol,Tick);

   _GlobalVariableSet(Name,Tick);
   Print("time --> ",_GlobalVariableGet<MqlTick>(Name).time);
   Print("bid --> ",_GlobalVariableGet<MqlTick>(Name).bid);

// Записываем/считываем массивы
   MqlTick Ticks[2];

   Ticks[0] = Tick;
   Ticks[1] = Tick;

   _GlobalVariableSet(Name,Ticks);
   
//    Print("time --> ",_GlobalVariableGet<MqlTick>(Name).time);
//    Print("bid --> ",_GlobalVariableGet<MqlTick>(Name).bid);
   
   _GlobalVariableDel(Name);
  }
//+------------------------------------------------------------------+


PS: compiler warnings possible use of uninitialized variable 'Res', should be removed if possible


 
Alexey Volchanskiy:

Personally, I miss multitasking. I remember (10 lines of nostalgia, youth skip), back in 2000 I was hanging around the RSDN programmers forum when the Pentium 4 was released. And Intel was going on about 15GHz on P4. Yeah, I'm not kidding, it was all over the place. Well, I don't know if they really thought so or if it was a hoax, but I didn't believe it, after all I'm an ironman.

I then made a big thread about multicore coming soon, you'll see, we need to get ready. People laughed, it was like a fairy tale, how can you program parallel code? It's a fantasy.

And who was right? Intel failed with its 15Ghz, then the desktop version received dual core Pentium D and then the breakthrough Duo.

And we are still living in 199*s on MQL5. No multithreading, no exceptions... Went for a watermelon out of grief...

From the description of MT5 it follows that it is multi-threaded. Due to the fact that the modern CPU is a dumpster of executable code under the user, then there are watermelons, there is no pragmatic sense in all the threading. Business is interested neither in efficient codes, nor in rational use of computational power: if there is not enough - buy more.

P.S. Maybe 1.5GHz? I could be wrong, in those years they defined a physical technology limit of 5nm, and from that the supposed GHz. Would like to go from 200nm to 5nm, just like that in a couple of years - certainly would.

 

In 2030 metatrader will be banned,

the person who will ban everything will come to power.

Then there will be one payment system in the world.

And one Ruler all over the world.

He will start putting chips in everyone and put everyone under GLONASS, 5G.

There will be no cash. Payments will be made through chips implanted in the body.

Only privileged members of society will be allowed to trade on the internet - those who think this ruler is a real god...


Amen.

 
Igor Makanu:

I built a script to test it, but I don't know how to read the MqlTick array.

Add this overload

template <typename T>
bool _GlobalVariableGet( const string Name, T &Value[] )
{
  double Tmp;
  const bool Res = GlobalVariableGet(Name, Tmp);

  if (Res)
  {
    double Array[];                                                         
                                                                            
    const int Amount = (int)Tmp;                                            
    const int Size = ArrayResize(Array, Amount / sizeof(double) +           
                                 ((Amount % sizeof(double) == 0) ? 0 : 1)); 
                                                                            
    for (int i = 0; i < Size; i++)                                          
      Array[i] = GlobalVariableGet(GetName(Name, i));                       
                                                                                                                                                        
    _ArrayCopy(Value, Array, 0, 0, Amount);
  }  

  return(Res);
}
Igor Makanu:

PS: compiler warnings possible use of uninitialized variable 'Res' , could be removed if possible

Add this line

  T Res;
  ZeroMemory(Res);
 
Unicornis:

From the description of MT5 it follows that it is multi-threaded. Due to the fact that modern processor in its work under user is a dump of executable codes, there are still watermelons, there is no pragmatic sense in all threading. Business is interested neither in efficient codes, nor in rational use of computational power: if there is not enough - buy more.

P.S. Maybe 1.5GHz? I could be wrong, in those years they defined the physical limit of the technology at 5nm, and from that the supposed GHz. I would like to go from 200nm to 5nm, just like that in a couple of years - of course I would.

I'm illiterate and don't read manuals. But I know that MT5 is multi-threaded only in optimizer.) In the tester it works in one thread only.

To parallelize it you can use OpenCL but this technology in itself is just supported by MT5.

And about 15GHz in roadmap I'm sure, I have programmer's memory, what I see, I'll never forget.