Download MetaTrader 5

Something really weird 2

To add comments, please log in or register
Gordon Gekko
623
Gordon Gekko  

Hi gurus,

I have an indicator that uses Symbol() for determining the instrument (there isn't hard coded instrument, just Symbol()).

I load the indicator say on EURUSD chart and save it as a template.

After I load this template say on USDCHF chart.

And here is the surprise: the indicator works based on EURUSD, not USDCHF!

(But, if I change the time frame, it switches to USDCHF from EURUSD.)

How can this be?!?!

Fernando Carreiro
2201
Fernando Carreiro  
ggekko:

Hi gurus,

I have an indicator that uses Symbol() for determining the instrument (there isn't hard coded instrument, just Symbol()).

I load the indicator say on EURUSD chart and save it as a template.

After I load this template say on USDCHF chart.

And here is the surprise: the indicator works based on EURUSD, not USDCHF!

How can this be?!

Show the code, otherwise, how to do you expect us to answer?

Does it perhaps store the "symbol" on an "extern" variable which is then transferred over in the "template"?

Gordon Gekko
623
Gordon Gekko  
FMIC:

Show the code, otherwise, how to do you expect us to answer?

Does it perhaps store the "symbol" on an "extern" variable which is then transferred over in the "template"?

Sorry, the code is long and private.

But, how can this be theoretically?!

There is nothing other than Symbol().


How is it possible to get EURUSD using Symbol() on a USDCHF chart?!

Fernando Carreiro
2201
Fernando Carreiro  
ggekko:

Sorry, the code is long and private.

But, how can this be theoretically?!

There is nothing other than Symbol().

How is it possible to get EURUSD using Symbol() on a USDCHF chart?!

I've already given you a theoretical possibility, namely - Does it perhaps store the "symbol" on an "extern" variable which is then transferred over in the "template"?

Without looking at the code, we can only guess! Since the code is private, you will just have to "debug" it yourself.

Gordon Gekko
623
Gordon Gekko  
FMIC:

I've already given you a theoretical possibility, namely - Does it perhaps store the "symbol" on an "extern" variable which is then transferred over in the "template"?

Without looking at the code, we can only guess! Since the code is private, you will just have to "debug" it yourself.

Thank you for your answer, but I don't understand excatly what you mean.

May I ask a little help? Would you write a little example what you talk about?

(Do you mean for example:

extern string mySymbol="GBPCHF";

No such thing in my code. Just Symbol().)

Fernando Carreiro
2201
Fernando Carreiro  
ggekko:

Thank you for your answer, but I don't understand excatly what you mean.

May I ask a little help? Would you write a little example what you talk about?

(Do you mean for example:

extern string mySymbol="GBPCHF";

No such thing in my code. Just Symbol().)

Do you perhaps use global terminal variables?

Do you use Graphical Chart Objects that might be providing persistent storage of data you use?

Gordon Gekko
623
Gordon Gekko  
FMIC:

Do you perhaps use global terminal variables?

Do you use Graphical Chart Objects that might be providing persistent storage of data you use?

No global variable.

Yes, there is a BitmapLabel. Why is it important in connection with Symbol()?

Have you any idea?

Fernando Carreiro
2201
Fernando Carreiro  
ggekko:

No global variable.

Yes, there is a BitmapLabel. Why is it important in connection with Symbol()?

Have you any idea?

Alternative method to see if we can find the source of the problem - Can you provide the "template" file itself? No need to supply the indicator or its code - just the "template" file. That can maybe narrow down the possibilities

In case the site does not allow you to attach a "template" file, just attach it as a ".txt" file.

Gordon Gekko
623
Gordon Gekko  
FMIC:

Alternative method to see if we can find the source of the problem - Can you provide the "template" file itself? No need to supply the indicator or its code - just the "template" file. That can maybe narrow down the possibilities

In case the site does not allow you to attach a "template" file, just attach it as a ".txt" file.

OK, here it is.

(Unfortunately I didn't find any interesting in it.)

Files:
Fernando Carreiro
2201
Fernando Carreiro  
ggekko: OK, here it is. (Unfortunately I didn't find any interesting in it.)
Agreed! I could not see anything obvious that could explain it either! So, it must be in the code. You will just have to "debug" it line by line in order to find the culprit! (Or let someone you trust have a look at it. Sometimes a different set of eyes my spot the problem more easily!)
Gordon Gekko
623
Gordon Gekko  
FMIC:
Agreed! I could not see anything obvious that could explain it either! So, it must be in the code. You will just have to "debug" it line by line in order to find the culprit!

:(  Done 100x, but nothing.

I think it is theoretically impossible to get EURUSD using Symbol() on a USDCHF (or any other) chart. Cannot imagine else, than it is a bug in MT4.

12
To add comments, please log in or register