You are making a gross mistake - you CREATE AN INDICATOR HANDLE AT EVERY TICK !!! This is a gross mistake! According to MQL5 style, HANDLE INDICATOR SHOULD BE CREATED ONLY ONCE and done in OnInit.
See the documentation for an example: iMA
I also recommend creating an indicator template using the 'MQL5 Wizard'.
Documentation on MQL5: Technical Indicators / iMA
- www.mql5.com
iMA - Technical Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
@Vladimir Karputov you are right. Moved it to the OnInit event and it worked. thanks.
Please attach your code (using the button ) and a screenshot of the indicator's operation - I'm interested to see what happened.
Here it is. Just moved the handle declaration to the OnInit section.
Files:
MAFastSkiwLength.mq5
3 kb
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 All,
I've written a test custom indicator that uses 2 MA. It drew the indicator fine when I first attached it to a chart
however when I changed the timeframe. It somehow only draw the last bar and continue from the latest bar.
Please help.
PS. There's no error in the expert tab.
Here's the code.