Something really weird 2

 

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?!?!

 
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"?

 
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?!

 
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.

 
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().)

 
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?

 
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?

 
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.

 
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:
 
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!)
 
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.

Reason: