Equity oscillator by MQL5 means - page 3

 

DV2010:

...Renat, as I understand it, the display of the indicator on the chart after testing is completed is based on the calculations made during the test and the filling of the indicator array. But what does it mean, that the results are not transferred from the tester to the custom indicator chart?

Of course, the indicator calculation data from the tester-agent is not transferred to the terminal chart. We won't pass hundreds of megabytes of calculated data to the terminal, and they will be immediately (and on the next tick) recalculated by the indicator (call of the function OnCalculate has not been canceled).

The indicator should calculate itself.

 

sergey1294:
Отвечу вам одно, пока не появиться режим визуализации решить вашу задачу не так просто. Есть одно решение, это записывать данные эквити в файл при тесте. потом данные из этого файла записать в буфер индикатора тем самым построить график эквити.

But where exactly do I write the data to the buffer?

I thought it could only be written to OnCalculated and tried to implement it that way.

 
DV2010:

Rosh, the variant for online has already been posted, but as someone who works primarily with History, I need a variant that works on historical data. And I still find it hard to understand what the main difficulty might be here.


Write equity values into a file. Then plot the indicator by these values. However, the data file will have to be transferred manually because during testing the files are written into agent_name/MQL5/Files folder.
 
DV2010:

But where exactly do I write the data to the buffer?

I thought it could only be written to OnCalculated and tried to implement it that way.

We use expert to write values into the file, then in the indicator we write the code for reading from the file and writing data into the buffer. I can't show you the code yet, it will take me some time to write it.

 
Renat:

Of course, the calculated indicator values cannot be transferred from the Tester-Agent to the terminal chart. We won't pass hundreds of megabytes of calculated data to the terminal, and they will be immediately (and on the next tick) recalculated by the indicator (call of the function OnCalculate has not been canceled).

Renat, the indicator should read itself

That's why I initialize the indicator array values with some values in the OnCalculatedmethod .But why is it possible to initialize (build) the indicator line in this way, while the Equityvalues do not?

 
DV2010:

Renat, the indicator should read itself

That's why I initialize the values of the indicator array with some values in the OnCalculatedmethod .But why is it possible to initialize (build) the indicator line inthis way, while the Equityvalues cannot?

Because prices have a history but Equity does not. Therefore, you need to build your own history for Equity by writing it into a file.
 
Rosh: Write equity values into the file. Then construct the indicator based on these values. However, the data file has to be transferred manually, while testing, the files are written in the folder Agent_name/MQL5/Files.

As I understand it, it should be written to the file in the Expert Advisor's OnInit based on definition via AccountInfoDouble(ACCOUNT_EQUITY) and read from the file - in OnCalculated indicator.

But why is the data on variable Equty through AccountInfoDouble(ACCOUNT_EQUITY) available directly in OnCalculated?

The code would then get too cumbersome.....

I can't understand ...OnCalculated in Print AccountInfoDouble(ACCOUNT_EQUITY) outputs some value .

What exactly prevents it from being immediately assigned to the array of indicator values?

I always thought that indication of values in the tester on the history differs from indication of current values only in the fact that the history is already recorded, while current data are just arriving.

 

sergey1294:
потому что цены имеют историю а эквити нет. По этому для эквити вам нужно строить собственную историю записав ее в файл.

But then how is Equty dynamics displayed at all through AccountInfoDouble(ACCOUNT_EQUITY) in OnCalculated Indicator (not only in OnTick Expert Advisor)?

Or does OnCalculated Indicator work differently in test mode and in display mode?

 

Declare two arrays Equity[] and Time[] on global level in EA.

Write the value of equity and time in the appropriate array when testing the EA.

Use a script to read the file at the end of testing and plot the equity on the required chart.

This is the best way for your purposes, I do not understand why you need an indicator.

 
DV2010:

As far as I understand, it should be written to the file in the Expert Advisor's OnInit based on definition via AccountInfoDouble(ACCOUNT_EQUITY) and read from the file - in OnCalculated indicator.

But why is the data on variable Equty through AccountInfoDouble(ACCOUNT_EQUITY) available directly in OnCalculated?

The code would then get too cumbersome.....

I can't understand ...OnCalculated in Print AccountInfoDouble(ACCOUNT_EQUITY) outputs some value .

What exactly prevents it from being immediately assigned to the array of indicator values?

I always thought that indicating values in the tester on the history differs from indicating current values only in the fact that the history is already recorded, while the current data is just arriving.

I don't even know how to explain it to you. AccountInfoDouble(ACCOUNT_EQUITY) stores the last equity value. After testing, as Renat said, the indicator is re-initialized and recalculated. Thus, equity data accumulated in the indicator buffer during the test are erased.
Reason: