lgb1:
I guess I could destroy my indicators during the BT and recreate them with the new TMF, without actually calling ChartSetSymbolPeriod() but what about detecting new bars? Since the chart TMF won't change(because I can't call ChartSetSymbolPeriod), every new bar will be every minute. will I need to code the isNewBar function in a different way so it will consider a different TMF or I need to somehow reload the bars in a new TMF? I'm confused...
I won't create and release ( IndicatorRelease() ) indicators in OnTick()! I would not use any available TF but only a few and have the indicators for all TF available because creating a new handel causes time to load the history of quotes and to calculate the indicator.
I guess I could destroy my indicators during the BT and recreate them with the new TMF, without actually calling ChartSetSymbolPeriod() but what about detecting new bars? Since the chart TMF won't change(because I can't call ChartSetSymbolPeriod), every new bar will be every minute. will I need to code the isNewBar function in a different way so it will consider a different TMF or I need to somehow reload the bars in a new TMF? I'm confused...
![Documentation on MQL5: Timeseries and Indicators Access / IndicatorRelease Documentation on MQL5: Timeseries and Indicators Access / IndicatorRelease](https://c.mql5.com/36/78/documentation-on-mql5-timeseries__1.png)
Documentation on MQL5: Timeseries and Indicators Access / IndicatorRelease
- www.mql5.com
IndicatorRelease - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Carl Schreiber #:
I won't create and release ( IndicatorRelease() ) indicators in OnTick()! I would not use any available TF but only a few and have the indicators for all TF available because creating a new handel causes time to load the history of quotes and to calculate the indicator.
I won't create and release ( IndicatorRelease() ) indicators in OnTick()! I would not use any available TF but only a few and have the indicators for all TF available because creating a new handel causes time to load the history of quotes and to calculate the indicator.
right. So i'll create all indicators in different timeframes on OnInit() and use them.
Fabio Cavalloni #:
Make an input of ENUM_TIMEFRAMES type, and use it for your indicators, new bar checking and all.
Make an input of ENUM_TIMEFRAMES type, and use it for your indicators, new bar checking and all.
During backtest, preload all needed timeframe if you want to use multiple one without reloading the tester.
Right, I'll give that a try. It seems like I'll need to use something like this to preload different timeframe data.
![Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access](https://c.mql5.com/36/78/documentation-on-mql5-timeseries__2.png)
Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
- www.mql5.com
Organizing Data Access - Timeseries and Indicators Access - MQL5 Reference - 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
Trying to develop a strategy that will change the timeframe(chart and symbols) when a certain triggers happens. Let's say I'm running my EA on M1 and after a certain number of operations I'd like to switch to M5 or M15 so it will have less signals and I'll be using that to control the number of orders when I'm not around. Like a guardrails type of thing.
I know ChartSetSymbolPeriod() can use be used in real time and I've used it before. Works like a charm, the chart is reloaded, all the indicators are also reloaded and bob is you uncle. Now during Backtesting it fails to execute and according to another forum post it seems like that's expected. However, changing timeframes is part of my strategy and it will greatly affect things like number of orders, Drawdown, etc and I would like to test it with historical data.
Is there anyway I can achieve that?
I guess I could destroy my indicators during the BT and recreate them with the new TMF, without actually calling ChartSetSymbolPeriod() but what about detecting new bars? Since the chart TMF won't change(because I can't call ChartSetSymbolPeriod), every new bar will be every minute. will I need to code the isNewBar function in a different way so it will consider a different TMF or I need to somehow reload the bars in a new TMF? I'm confused...
This is in MT5/MQL5 btw.