There may be a better option...
#include <Expert\ExpertSignal.mqh> CiClose Close[3]; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- Close[0].Create(_Symbol,PERIOD_M15); Close[1].Create(_Symbol,PERIOD_H1); Close[2].Create(_Symbol,PERIOD_H4); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- double closeM15=Close[0].GetData(1); double closeH1=Close[1].GetData(1); double closeH4=Close[2].GetData(1); }
Ernst Van Der Merwe:
There may be a better option...
Thanks Ernst,
Is there a recommended way to pass that onto CExpert? I see that there's a TimeframeAdd method but it's not clear how that should be accessed.
https://www.mql5.com/en/docs/standardlibrary/expertclasses/expertbaseclasses/cexpert/cexperttimeframeadd
![Documentation on MQL5: Standard Library / Trading Strategy Classes / Base classes for Expert Advisors / CExpert / TimeframeAdd Documentation on MQL5: Standard Library / Trading Strategy Classes / Base classes for Expert Advisors / CExpert / TimeframeAdd](/i/community/logo_mql5_small.png)
Documentation on MQL5: Standard Library / Trading Strategy Classes / Base classes for Expert Advisors / CExpert / TimeframeAdd
- www.mql5.com
Standard Library / Trading Strategy Classes / Base classes for Expert Advisors / CExpert / TimeframeAdd - Reference on algorithmic/automated trading language for MetaTrader 5
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I've been using CExpertSignal and it's data access methods (Open, Close, High, Low) from the series mask successfully for a single time frame. However I'd like to expand it to use multiple timeframes and can't seem to find any documentation on how to achieve it with the base classes. Does anyone have any pointers on how to achieve this?
For now I've been using the Copy... methods (CopyOpen, CopyHigh...) but ideally would like that to be abstracted away.
Cheers