Download MetaTrader 5

Attaching the same custom indicator to a chart more than once with different settings

To add comments, please log in or register
balintba
18
balintba  

Hello,

 

I try to write a custom indicator. I have done quite well, but I noticed a strange thing. If I try to attach 

my custom indicator to the same chart more than once, with different settings, the second indicator window

does not print any value.

If I attach to the chart the indicator only once, it seems to work just fine, but if I attach the same indicator

with different settings once more, the second example of the indicator does not work at all 

Did any of you have similar problem? Do you have any idea, what could cause this?

Any comments would be appriciated.

Thanks in advance! 

Step on New Rails: Custom Indicators in MQL5
Step on New Rails: Custom Indicators in MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.
Alain Verleyen
Moderator
32417
Alain Verleyen  
balintba:

Hello,

 

I try to write a custom indicator. I have done quite well, but I noticed a strange thing. If I try to attach 

my custom indicator to the same chart more than once, with different settings, the second indicator window

does not print any value.

If I attach to the chart the indicator only once, it seems to work just fine, but if I attach the same indicator

with different settings once more, the second example of the indicator does not work at all 

Did any of you have similar problem? Do you have any idea, what could cause this?

Any comments would be appriciated.

Thanks in advance! 

Yes, your code !
balintba
18
balintba  

Hey,

 

thanks for your reply. Of course, it is caused by my code. There is no question about it.

I just wondered if some of you have had a similar problem in the past. My code is quite long,

and I just wonder, if you have some idea what could be the possible cause in my code.

Too much memory consumption (I have 11 indicator buffers), maybe? I understand that my

question may be too general, but I just do not think, that it would be good to post all the 2000 rows of my code. I do not

wish to rob anyone`s time.

Did you encounter earlier by other indicators with similar problems? I just thought that there may be some known

issues, which I did not consider...

Alain Verleyen
Moderator
32417
Alain Verleyen  

Without the code, it's difficult to help you. If you want you can attach it, and maybe someone will help you.

Otherwise you have to debug it and ask more specific question if you need help.

balintba
18
balintba  

Ok. Thank you very much for your comment and time. I appriciate it.

I have deleted some buffers, which would have hold information regarding trading activity (deals entry_in/deals entry_out) and now

the indicator works without any problem. As my problem is solved, I ask the following question only out of curiosity:

Is there any inherent limitation printing trading activity on the chart as indicator plot? Can you use the OnTrade() event inside

of indicators?

As I do not have too much experience with programming the most possible explanation seems to be, that I made some mistakes

during implementation of these functions. I will check and double-check them, if I cant find any error, I may post this part of the program 

for review. Thanks for your time and effort again!

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Trade Constants / Deal Properties - Documentation on MQL5
Alain Verleyen
Moderator
32417
Alain Verleyen  
balintba:

Ok. Thank you very much for your comment and time. I appriciate it.

I have deleted some buffers, which would have hold information regarding trading activity (deals entry_in/deals entry_out) and now

the indicator works without any problem. As my problem is solved, I ask the following question only out of curiosity:

Is there any inherent limitation printing trading activity on the chart as indicator plot? Can you use the OnTrade() event inside

of indicators?

As I do not have too much experience with programming the most possible explanation seems to be, that I made some mistakes

during implementation of these functions. I will check and double-check them, if I cant find any error, I may post this part of the program 

for review. Thanks for your time and effort again!

Please read the documentation : https://www.mql5.com/en/docs/runtime/running
Documentation on MQL5: MQL5 programs / Program Running
Documentation on MQL5: MQL5 programs / Program Running
  • www.mql5.com
MQL5 programs / Program Running - Documentation on MQL5
To add comments, please log in or register