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

 
neverness:

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 script 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 !!!

Why would you call a script from an indicator if all the necessary functionality can be described in the indicator?
 
Vitaly Gorbunov:
Why do you need to call a script from the indicator, if all of the necessary functionality can be described in the indicator?

This is the simplest procedure in any programming environment. In C++ there is no problem with it at all.

We build a graphical object from a data stream. The object's position, shape and other characteristics depend on the values of this flow.

Since the indicator is responsible for the flow of input data in the MQL environment, we construct the objects of interest in this environment.

Everything is logical.

But MQL does not allow to build these objects.

This is despite the fact that this is no problem in C++, BASIC, JavaScript or any other programming environment.

What kind of "necessary functionality" you intended to describe is a mystery to me.

In general.

Programmers usually speak in a CODE LANGUAGE.

If you can do it, please give me an EXAMPLE of CODE!

If you don't, you have no other option than to agree with me.

It's as simple as that!

 

То есть, требуется не просто бросить объект на форму, или создать независимый ни  от чего объект, как в Вашем примере, а внедрить этот объект в вычислительную среду индикатора .

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

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


What is the problem if the indicator knows how to work with this object, it will work with this object. Can you concretely describe the problem? Otherwise we are discussing a spherical horse in a vacuum.

 
neverness:

This is the simplest procedure in any programming environment. In C++ there is no problem with it at all.

We build a graphical object from a data stream. The object's position, shape and other characteristics depend on the values of this flow.

Since the indicator is responsible for the flow of input data in the MQL environment, we construct the objects of interest in this environment.

Everything is logical.

But MQL does not allow to build these objects.

This is despite the fact that this is no problem in C++, BASIC, JavaScript or any other programming environment.

What kind of "necessary functionality" you intended to describe is a mystery to me.

In general.

Programmers usually speak in a CODE LANGUAGE.

If you can do it, please give me an EXAMPLE of CODE!

If you don't, you have no other option than to agree with me.

It's as simple as that!

Not knowing how to use language is no reason to be insulted.

Codes abound in codobase, different ones, for all tastes and colours.

MQL5 Code Base
MQL5 Code Base
  • www.mql5.com
Две одинаковые торговые системы (для лонгов и шортов), построенные на сигналах индикатора ColorSchaffJJRSXTrendCycle, которые можно настраивать различным образом в одном эксперте с возможностью менять размер предстоящей сделки в зависимости от результатов предыдущих сделок для данной торговой системы.
 

Строим графический объект по потоку данных. Положение объекта, его форма и другие характеристики зависят от значений этого потока.

Since the indicator is responsible for the input data flow in the MQL environment, we build the objects of interest in this environment.

Everything is logical.

But MQL doesn't allow to build these objects.


What object cannot be built in the indicator?

 
Vitaly Gorbunov:

What is the problem if the indicator knows how to work with this object it will work with this object. Can you specifically describe the problem? Otherwise we are discussing a spherical horse in a vacuum.

The matter is simple.

Let's take the event of the indicator

int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])

and, for example, take a thread of values orn[] and if the value in this thread is greater than the preset one, we will construct some graphical script object in a certain point of the chart with the calculated characteristics.

Everything is elementary simple.

In other words, we need to embed the script object OnStart() in the data field OnCalculate() and construct the object of interest with calculated values.

It is elementary simple.

How to do it in MQL ???

 
Vitaly Muzichenko:

Not knowing how to use the language is not a reason to be insulted.

Codes abound in kodobase, of all kinds, for all tastes and colours.

Unskillfulness is spelled together -> https://ru.wiktionary.org/wiki/неумение

I've said before that I've deliberately left out the "maths shell" of MQL.

This also refers to those very "different codes", which "abound in kodobase" and are of all "tastes and colours".

Well, dear Vitaly!

I myself take such remarks about me as an insult.

And be kind enough to get a portion of response.

Here it is.

As you correctly noted, all sorts of "miracle codes" that provide 1000% profit in kodobase really more than enough.

But the whole problem is how true the information offered to us by the authors of these codes is.

And if we mathematically strictly formulate the task of building "win-win EAs", this task will sound something like this

The wording of the problem:

Is it possible to build an EA that gives a win-win result in any situation selected by this EA?

Solution of the problem.

So.

As to the purely mathematical solution of the problem, it turns out that we can specify the combination of

of quotes flow, in which this EA will knowingly lose, and the trader will knowingly lose his/her funds.

Of course, I will not give a purely mathematical solution of this problem, but you can be sure it is true.

That is, from mathematical point of view, for any advisor, you can specify such or such situations when actions of this EA will be unprofitable for a trader.


If we now approach the question from the legal point of view, all offers to sell any Advisor are nothing more than another "fraudulent scheme",

Because no Expert Advisor is able to provide a "win-win".


Therefore, dear Vitaly, no "knowing how to use the language" and no knowing "how to use codes" will protect a trader from losses.

And it certainly cannot be an insult.

So next time, choose your language more carefully.

 
Vitaly Gorbunov:

What object cannot be built in the indicator?

Well, build some.

Personally, I don't see any such objects on the horizon that can be built.

I'd like to see at least something.

I'm a "newbie" to MQL, after all. Maybe I don't know something or have overlooked something.

 
neverness:

It's simple.

We take an indicator event

int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])

and, for example, take a thread of oren[] values, and if the value in this thread is greater than the preset one, we will construct some script graphical object at a certain calculated point of the chart with the calculated characteristics.

Everything is elementary simple.

In other words, we need to embed the script object OnStart() in the data field OnCalculate() and construct the object of interest with calculated values.

It is elementary simple.

How to do it in MQL?

Well, build this object and then control it.

How about this - describe a simple task, and on Monday I will try to implement it.

 
Vitaly Gorbunov:

So build this object and then control it. What's the big deal?

Let's say you describe a simple task and I will try to implement it on Monday.

I have already described a simple task.

Open MetaEditor.

Click on File->Create.

In the pop-up field select Indicator.

In the indicator OnCalculate() introduce any script object with OnStart() event.

I personally don't know how to do it. For example, like this:

int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//---
for(int i = 1; i < 100;i++)

{

if(open[i] > Max)

{

OnStart()

And here we need to write a script for building the object we are interested in. For example, an ellipse or a letter on a chart or something else

} //if(open)

} //for(int i)
//--- return value of prev_calculated for next call
return(rates_total);
} // OnCalculate

This must look something like this.

But this code is not accepted by the MQL translator.