Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 621

 
Vitaly Gorbunov:
The goal must justify the means. If you have the source code of all the necessary components, it is easier to combine everything in one EA. If this is not possible, it is necessary to organize the communication between the modules of all the components, but this is not a task for beginners.

The primary task for beginners is to learn how to write the "sources of all the necessary components". Otherwise, newbies will gather so much ... that we will be accused of hacking the brains of Martians.

 
Alexey Viktorov:

The primary task for beginners, is to learn how to write the "sources of all required components". Otherwise, beginners will gather so much ... that we will be accused of hacking brains of Martians.

That's right! In general, if you want to learn how to program, you should start with simple programs, gradually moving to more complex ones. Then there will not be questions such as I want something that I do not even know.

 
Hello, I have the source code of an EA, please help me add some protection to it so that it works only on a certain specified account.
I tried to do it on https://www.mql5.com/ru/articles/1572
I want to try it but i can not get it to work properly.
I found a complete algorithm, but I don't understand where to put it
#property copyright "Copyright © 2009, Sergey Kravchuk"
#property link      "http://forextools.com.ua"

int start()
{  
  string char[256]; int i;

  for (i = 0; i < 256; i++) char[i] = CharToStr(i);
  // номер счета на котором разрешено работать эксперту
  int    AllowedAccountNo = StrToInteger(/* 49153 */ char[52]+char[57]+char[49]+char[53]+char[51]); 
  string AllowedServer = /* UWC-Demo.com */ char[85]+char[87]+char[67]+char[45]+char[68]+
  char[101]+char[109]+char[111]+char[46]+char[99]+char[111]+char[109];

  if (AccountNumber() != AllowedAccountNo || AccountServer() != AllowedServer) 
  {
    Print("Вы не имеете права использовать этот скрипт!");
    return(1);
  }
  
  Print("Вы можете использовать этот скрипт!");
}
Защищайтесь, господа разработчики!
Защищайтесь, господа разработчики!
  • www.mql5.com
Вопросы защиты своей интеллектуальной собственности все еще остаются большой проблемой. В статье описаны основные принципы защиты разработок на MQL4, используя которые можно если не совсем побороть воровство результатов многодневного труда разработчика злоумышленником, то, по крайней мере, настолько усложнить вору его "труд", чтобы ему просто...
Files:
333.mq4  16 kb
 
helping123:
Good afternoon, have the source code of an EA, please ask for help to add a protection there that it would only work on a certain specified account.
Tried to do according to https://www.mql5.com/ru/articles/1572
I want to use it as a reference but i am not sure i can help.
I found a complete algorithm, but I don't understand where to put it

Forum on trading, automated trading systems and trading strategy testing


FXwin, 2018.09.14 11:48

bool StopTrade = true;

int start() {
//---------------------------------------------------------------------------------------------------------------+
//  привязка к конкретному торговому счету
  if(AccountNumber() != 555777){ 
     Comment("Invalid account... forex-time@mail.ru");
  if(StopTrade) Alert("Invalid account... forex-time@mail.ru"); StopTrade=false; return(0);}
//---------------------------------------------------------------------------------------------------------------+  

 
Alexey Viktorov:

Really... What was the original task? I don't remember either...:)))))))))))

What are you children doing, really, stirring up the waters?

Just go into the MetaEditor, and type in the command: File->Create...

This will bring up a form with different dummy files.

In particular, it will be dummy files:

- Expert Advisor

- Custom indicator

- Script

- Library, etc.

We are interested in the first three items: Expert Advisor, Custom Indicator and Script.

Let's compare these dummies:

In Expert Advisor we have events:

-OnInit(), OnDeinit(), OnTick(), OnTimer, OnChartEvent() ... everything, no more.

In the script we have the events:

- OnStart() ... that's it, no more.

in the indicator we have events:

- OnInit(), OnCalculate(), OnTimer, OnChartEvent() ... everything, no more.

The natural question here is how to make the connection between these objects.

It turns out that there is and can be no connection between them in MQL, because the data streams between these objects are completely separated and there is no connection between them.

Moreover, I am surprised by the fact that the creators of MQL give us this fact as a "good".

And if, for example, in C++ I can easily call the BASIC translator, or Javascript or any other translator, and go, for example, to Android programming environment,

in the framework of MQL, I can't even create a so-called "script" in "indicator" environment, because indicator environment doesn't accept OnStart() command.

What kind of freak is this?

And there are more than enough of such ugly things in MQL.

They are at every step.

I read the description of MQL - and I'm surprised, because there's nothing else to do.

All the while the creators of MQL loudly proclaim that MQL is a descendant of C++.

Of course, I'm sorry, but I want to ask MQL creators: - Heir to what? - In its ugliness?


I unintentionally compare MQL with the famous 1C programming environment. They also claim to be the heirs of C++.

But everything is done there in a much more decent way.

And the graphical objects, and communication between modules and much more.

And what's there in MQL?

No built-in classes, no thread-related objects... and nothing at all.

And I haven't said anything about the mathematical shell of the terminal!!!

That's a whole separate topic for surprises!!!

 
neverness:

What are you children doing, really, stirring up the waters?

Just go into the MetaEditor, and type in the command: File->Create...

This will bring up a form with different dummy files.

...

That's a whole separate topic for surprises!!!

Nothing prevents you from writingOnStart() inOnCalculate(), as in the script

 
Vitaly Muzichenko:

Nothing prevents you from writingOnStart() inOnCalculate(), as in the script

Example of working code, would you be kind enough to show us to build an ellipse or other object in the indicator environment, for example.
 
Infopanel
Infopanel
  • www.mql5.com
Пример создания простого и быстрого меню с поддержкой нескольких языков. В примере выводится информация о цене, времени до следующего бара, балансе счета, количестве ордеров. Данный пример можно использовать в качестве шаблона для создания своих разработок. Минус данного метода при добавлении, удалении или редактировании объектов необходимо...
 
neverness:
Please show us an example of a working code to build an ellipse or other object in an indicator environment, for example.

Indicators are the right place to build graph objects of any kind.

 
Vitaly Gorbunov:

https://www.mql5.com/ru/code/19220

Indicator as an example of working with objects.

We are not children, we are perfectly sane individuals.

Let's not try to whisper, and deceive each other.

Once again I repeat my question:

Please give me a simple code of the indicator, in which some scripted object (OnStart(), for example, an ellipse) is built.

The procedure is as follows:

You enter the MetaEditor. Click File->Create....

Click on Indicator.

And in this environment you enter the code of script object (OnStart(), for example, ellipse).

It's so simple !!!

Good luck !!!

That is, you want not just throw the object on the form, or create an object independent of anything, as in your example, but introduce this object in the computational environment of the indicator .

In other words, the indicator data flow changes - the graphical object also changes.

Not like in your example, it is just a dummy on the chart that doesn't depend on anything.

Reason: