OnTimer - How is the functionality of OnTimer, when in a custom indicator, which is called from an EA? - page 2
Yes. Multiple.
1. Use ChartIndicatorAdd
2. Use CusomEvents
3. Use OnTimer in EA
4. Misuse OnCalculate
I suppose all you can do is to get a call hook into your specific constellation is option 4.
Goes like this:
Before returning from OnCalculate, you build a loop which does following:
1. Check for new ticks. (Use CopyTicks)
2. Check if OnTimer needs to be called.
If a new tick arrives, interrupt the loop and return from OnCalculate. It will be called right away again.
This way you have a continuous loop monitoring your OnTimer.
This option will give you a hard time, because it blocks the whole chart thread of that specific symbol.
Not very neat, to be honest, and surely an ugly solution.
Indicators - Charts -
Expert Advisors and Custom
Basic Principles - Trading

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