How to get info on current chart

 

Hi

Is there any way to get info on the current chart?

I need to have a generic EA that can run on any chart but has specific values if it is running on the GBPUSD symbol chart and different values for the rest of the symbols.

In order to do this I must be able to query the current chart and have it return the symbol so that I can set these values.

Can someone please help me and let me know how to query the chart I'm on. Get the symbol, current time frame etc.

Much appreciated.

Adoballa

 
AdoBalla:

Hi

Is there any way to get info on the current chart?

I need to have a generic EA that can run on any chart but has specific values if it is running on the GBPUSD symbol chart and different values for the rest of the symbols.

In order to do this I must be able to query the current chart and have it return the symbol so that I can set these values.

Can someone please help me and let me know how to query the chart I'm on. Get the symbol, current time frame etc.

Much appreciated.

Adoballa

Adoballa

> In order to do this I must be able to query the current chart and have it return the symbol so that I can set these values...

Yes, you could but why would you want to?
Optimising an EA for one symbol & one timeframe can take days to run through the permutations...

IMHO - the settings for each EA can be so different, even if the system is similar, its not worth adding extra coding complexity & optimiser CPU cycles just for a 'generic' EA...
Also IMHO, I make mine error if they are on anything other than the intended timeframe & currency pair!

My 2c worth :)
 

"Can someone please help me and let me know how to query the chart I'm on. Get the symbol, current time frame etc."

Current chart symbol is, hold your breath..... Symbol()

Current chart period, is, you guessed it.... Period()

int start(){

Comment("This chart is "+Symbol()+" and has a time period of "+Period()+" minutes");

return(0);

}

 

That was exactly what I wanted.

Cheers

phy:

"Can someone please help me and let me know how to query the chart I'm on. Get the symbol, current time frame etc."

Current chart symbol is, hold your breath..... Symbol()

Current chart period, is, you guessed it.... Period()

int start(){

Comment("This chart is "+Symbol()+" and has a time period of "+Period()+" minutes");

return(0);

}

Reason: