Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1184

 
secret:
How to call a custom indicator from an EA? In mql4 it was done by calling iCustom().

https://www.mql5.com/ru/docs/series/copybuffer

but the example in the help is not illustrative, search the articles - there was once a series of articles on the transition to MQL5 - there are good examples

 
Igor Makanu:

https://www.mql5.com/ru/docs/series/copybuffer

but the example in the help is not illustrative, search for articles - there was once a series of articles on the transition to MQL5 - there are good examples

uh-huh

But I don't need to get the indicator buffer, I just need to pull it to work its OnCalculate()

 
secret:

yep

But I don't need to get an indicator buffer, I just need to yank it to make it work its OnCalculate()

Here are some examples, take advantage of them

 

I tried just adding the indicator viaChartIndicatorAdd() - it didn't work.

After starting the tester, a chart with the indicator appeared in the terminal window, but it does not work with the tester's ticks.

And it is not added to the tester window at all.

 

That helped, thanks)

And just to avoid getting up twice - why is a new chart added to the terminal when running in the tester?

 
secret:

That helped, thanks)

And just to avoid getting up twice - why is a new chart added to the terminal when running in the tester?

Right click in the tester on the backtest tab - there is a checkbox for auto-open chart - this is probably what you need

 

Hi Connoisseurs!

Here is the code :

struct STRUCT_POSITION {\...\}

STRUCT_POSITION SPosition[];

Question:

What is STRUCT_POSITION SPosition[]; ? If it's creating an instance of the structure, why is it a dynamic array? Is it really possible to do this? Why?


I will be very grateful for your answer.

 
odyn:

Hi Connoisseurs!

Here is the code :

struct STRUCT_POSITION {\...\}

STRUCT_POSITION SPosition[];

Question:

What is STRUCT_POSITION SPosition[]; ? If it's creating an instance of the structure, why is it a dynamic array? Is it really possible to do this? Why?


I would be very grateful for an answer.

The line

STRUCT_POSITION SPosition[]

declares an array (array name 'SPosition') of the STRUCT_POSITION structure. And this array is dynamic, since nobody knows how many positions will be written into the array.

 
Vladimir Karputov:

The line

declares an array (array name 'SPosition') of the STRUCT_POSITION structure. And this array is dynamic, because nobody knows how many positions will be written into the array.

Yes, but there is no array in the structure declaration. There are only variables of different types.

I must have misunderstood something.

I'm very grateful to you for replying, would you mind explaining it? I don't understand, how can you declare a structure array, if there was no array in the structure description? (I didn't write that right away, my mistake) (By the way, isn't this your EA? I'm studying it as a samplehttps://www.mql5.com/ru/code/27559 )

 
odyn:

Yes, but there is no array in the structure declaration. There are only variables of different types.

I must be missing something.

I'm very grateful to you for answers, could you explain it? I don't understand, how can you declare a structure array, if there was no array in the structure description? (I didn't write that right away, my mistake) (By the way, isn't this your EA? I'm studying it as a samplehttps://www.mql5.com/ru/code/27559 )

If you have a question about the code, ask in the code discussion.

Reason: