NEVER create an indicator handle in OnTick() you will crash as with each tick a new handle is created and these are limited!
See here:
Quickstart for newbies: https://www.mql5.com/en/articles/496
and: https://www.mql5.com/en/articles/100
cookbook: https://www.mql5.com/en/search#!keyword=cookbook
or https://www.mql5.com/en/search#!keyword=Tips%20from%20a%20professional%20programmer&module=mql5_module_articles
If the program compiles with no error but doesn't do what is should use the debugger:
Code debugging: https://www.metatrader5.com/en/metaeditor/help/development/debug
Error Handling and Logging in MQL5: https://www.mql5.com/en/articles/2041
Tracing, Debugging and Structural Analysis of Source Code, scroll down to: "Launching and Debuggin": https://www.mql5.com/en/articles/272
Bear in mind there's virtually nothing that hasn't already been programmed for MT4/MT5.
So searching might be faster than trying: https://www.mql5.com/en/search
- www.mql5.com
Thank you for the advice I will move my handles and try snooping at other people's code.
Look at this code which should give you some answers
Free download of the 'Bands Bollinger code for beginners by William210' indicator by 'William210' for MetaTrader 5 in the MQL5 Code Base, 2023.08.31
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
However the print functions reliably return an identical value, one that appears in fact to be the middle band value.
Of course, x = x, and so the range is always 0.
As I'm getting no error code and the data set is intact, I'm not even sure how to trouble shoot? only one band is generated on the chart whenI test it.