I want a confirmation about the use of Symbol() and Period() functions

 
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:
m_handle=iATR(Symbol(),Period(),ma_period);
m_handle=iBearsPower(Symbol(),Period(),ma_period);
m_handle=iBullsPower(Symbol(),Period(),ma_period);
m_handle=iDeMarker(Symbol(),Period(),ma_period);
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:

pSymbol // Parameterized value from iCustom function
pPeriod // Parameterized value from iCustom function
m_handle=iATR(pSymbol,pPeriod,ma_period);
m_handle=iBearsPower(pSymbol,pPeriod,ma_period);
m_handle=iBullsPower(pSymbol,pPeriod,ma_period);
m_handle=iDeMarker(pSymbol,pPeriod,ma_period);
Universal Oscillator with a GUI
Universal Oscillator with a GUI
  • www.mql5.com
The article describes the process of creation of a universal indicator based on all oscillators available in the terminal, with its own graphical interface. The GUI allows users to quickly and easily change settings of each oscillator straight from the chart window (without having to open its properties), as well as to compare their values and to select an optimal option for a specific task.
 
Michael Reuben Msidada:
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
}

 
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
 
Busingye Tusasirwe #:

Michael,

Hope this answer your question. You may want to use this code....

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?

 
Fernando Carreiro #:
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
}
 
Busingye Tusasirwe #:

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. 

 
I've managed to clarify the doubt I had regarding this matter. Here's the deal: the indicator's author is correct in asserting that when Symbol() and Period() are called within the indicator code, they won't return the symbol and period of the chart to which the indicator is attached. Instead, they will return the symbol and period specified as parameters when iCustom is called. So, there's no need for concern. I've personally tested the code myself, and it worked as expected. It did strike me as a bit unusual because this behavior wasn't explicitly mentioned in the documentation for Symbol() and Period().
Reason: