Download MetaTrader 5
To add comments, please log in or register
Use MQL5 Cloud Network. It is secure!
Rogelio Rosales
23
Rogelio Rosales 2016.11.30 22:38 

I draw some Fibos at 5Min, 15Min, 1H and 1Day, I use the function ObjectsTotal() and it sends me 12 and it's OK, but I want to know for example:

Fibo1677 was draw at 5Min Period

Fibo 1900 was draw at 1H Period

Fibo 1873 was draw at 15Min Period

Fibo 1123 was draw at 5Min Period

Fibo 7125 was draw at 1H Period.... etc etc

 Beforehand, thank you

honest_knave
958
honest_knave 2016.12.01 09:11  

The only ways I can think of doing this are:

  • Store the fib name and current timeframe when you create each fib. Your method of storage will have to cope with terminal restarts and chart timeframe changes. So maybe look at global variables or writing to file.
  • Change the fib name when you create it to include the timeframe e.g. Fibo1677 becomes Fibo1677 - PERIOD_H1.
  • Add the current timefame to the description when you create the fib. But, this may be a problem if you display object descriptions. Or maybe a bonus if you want to be reminded visually?
  • Set the visibility of the fib to the current timeframe when you create it. This will then be your reference for the timeframe it was created on. But, this is a problem if you want to see your fib on other timeframes.
 Edited to remove inaccurate info (thank you Keith Watford)
Keith Watford
Moderator
7899
Keith Watford 2016.12.01 10:34  
honest_knave:

  • Change the fib name when you create it to include the timeframe e.g. Fibo1677 becomes Fibo1677 - PERIOD_H1. You can't actually rename an object, so you will need to create a new object with the new name and then delete the old one.

You can't rename an object?

You can in mq4, don't know about mq5

honest_knave
958
honest_knave 2016.12.01 10:47  
Keith Watford:

You can't rename an object?

You can in mq4, don't know about mq5

Well, quite possibly I am wrong...? BTW I'm talking about doing it from code, not from the properties window (perhaps I should have made that clearer)
Keith Watford
Moderator
7899
Keith Watford 2016.12.01 10:59  
ObjectSetString() with OBJPROP_NAME  in mq4
honest_knave
958
honest_knave 2016.12.01 11:03  
Keith Watford:
ObjectSetString() with OBJPROP_NAME  in mq4

Haha, thank you very much! Every day is a school day.

Very early on I had read that you couldn't rename objects and I just took that as a given from that point forward. With no real need for it, I never explored it.

Keith Watford
Moderator
7899
Keith Watford 2016.12.01 11:10  
honest_knave:

Haha, thank you very much! Every day is a school day.

Very early on I had read that you couldn't rename objects and I just took that as a given from that point forward.

It's great that we can still learn from each other.
Rogelio Rosales
23
Rogelio Rosales 2016.12.02 19:39  
Thank you honest_knave, it works! ^^ 
/
To add comments, please log in or register