I'm seeking confirmation regarding the utilization of the Symbol() and Period() functions within custom indicator code, particularly concerning their impact when the indicator is utilized within a Multi-Currency EA. The Multi-Symbol EA is designed to facilitate trading across multiple symbols using a single chart. It conducts analysis across various timeframes and symbols before executing trades. In this context, the custom indicator contains calls to the Symbol() and Period() functions within its code.
The indicator is using other indicators for analysis, so there is lines like this:
But the indicator works perfect when placed on a chart
These functions are hard-coded to utilize the current symbol and timeframe period, rather than allowing these parameters to be customized. This raises the concern that when the EA is applied to a chart, the custom indicator will always return information from the current chart, rather than adapting to the specific Symbol and Period defined in the iCustom function. Am I correct in my understanding that this custom indicator may not be suitable for use within a Multi-Symbol and Multi-Timeframe EA due to this behavior unless it updated, or is there something I might be overlooking?
What I expected is these lines to be something like this:
Michael,
Symbol() or _Symbol //Means current chart symbol where the indicator is attached. Period() or _Period //Means current period of the chart where the indicator is attached.
Hope this answer your question. You may want to use this code....
if(Symbol()=="GBPUSD"){ //do the following, eg send trade when Bid-TodayOpen>=35pips }
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Thank you reply!.
I do understand the use of
Symbol() or _Symbol //Means current chart symbol where the indicator is attached. Period() or _Period //Means current period of the chart where the indicator is attached.
My question is about the clarification of usage of Symbol() and Period() and their implications/effects of usage of the mentioned indicator in the context of multi-symbol EA. You have to understand there is no confusion arise when the indicator with those two functions is used on the on single pair EA. The confusion arises when it is used on the multi-symbol multi-timeframe EAs, that's where I have doubts.
So let say the Multi-symbol EA placed on GBPUSD chart, how the EA gonna use indicator to analysise EURUSD? because when it create indicator handle the handle gonna be created is for GBPUSD and not EURUSD since the code Symbol() is used in the indicator and not a variable with a value of EURUSD. You see the issue here?
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Noted.
I am assuming the indicator is attached to "GBPUSD" chart: in this case do this...
double openEURUSD=iOpen("EURUSD", PERIOD_D1, 1);//Means the Open of the EURUSD yesterday double lowEURUSD=iLow("EURUSD", PERIOD_D1, 1);//Means the Low of the EURUSD yesterday // Etc....then do this: if(MathAbs(openEURUSD-lowEURUSD)>=35*10*_Point){ //do this..notice the _Point refers to the chart where the indicator is attached(GBPUSD). So you may have to work out the _Point for EURUSD }
I am assuming the indicator is attached to "GBPUSD" chart: in this case do this...
Yeah, hard-coding symbol EURUSD will work. But the EA will trade 28 pairs at the same time, so you see the problem here, and don't forget the variations of naming like EURUSD.pro, EURUSD_c, EURUSDraw etc.. So hard-coding symbol names is not feasible and not practical. So the symbol name has to come from iCustom as in a variable and not hard-coded "EURUSD" or using Symbol(). And it doesn't matter what that symbol is as long EA checks it is tradeable, EA just pass the symbol variable to the iCustom when creating an indicator handle.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
The indicator is using other indicators for analysis, so there is lines like this:
But the indicator works perfect when placed on a chart
These functions are hard-coded to utilize the current symbol and timeframe period, rather than allowing these parameters to be customized. This raises the concern that when the EA is applied to a chart, the custom indicator will always return information from the current chart, rather than adapting to the specific Symbol and Period defined in the iCustom function. Am I correct in my understanding that this custom indicator may not be suitable for use within a Multi-Symbol and Multi-Timeframe EA due to this behavior unless it updated, or is there something I might be overlooking?
What I expected is these lines to be something like this: