Perhaps you should read the manual, or press F1 in the editor.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
iBands does not return a double. They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate/OnStart (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 (2020)
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
How to call indicators in MQL5 - MQL5 Articles (2010)
My first step is to just get the bollinger band values to print so that I can then add logic to use those values. When I run the code below I am only getting '10.0' as the output for every tick
Also, I know that I should have a parameter that differentiates between the upper and lower bands. When I searched for examples, they were using MODE_UPPER & MODE_LOWER in the iBands function. Although when I tried using the same I got an unknown value error.
int bandsHandle; int OnInit() { bandsHandle = iBands(NULL, PERIOD_H1, 20, 0, 2.0, PRICE_CLOSE); return(INIT_SUCCEEDED); } void OnTick() { double upperBuffer[], lowerBuffer[]; CopyBuffer(bandsHandle, 1, 0, 1, upperBuffer); CopyBuffer(bandsHandle, 2, 0, 1, lowerBuffer); Print("Upper: ", upperBuffer[0]); Print("Lower: ", lowerBuffer[0]); } void OnDeinit(const int reason) { IndicatorRelease(bandsHandle); }
i hope that helps a bit
i hope that helps a bit
yeah I got confused trying to read the weak documentation they provided
thanks for the help
[Y]eah I got confused trying to read the weak documentation they provided[.]
Kelvin Muturi Muigua, 2024.05.02 13:26
Learn how to create custom indicators using MQL5. This introductory article will guide you through the fundamentals of building simple custom indicators and demonstrate a hands-on approach to coding different custom indicators for any MQL5 programmer new to this interesting topic.- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
My first step is to just get the bollinger band values to print so that I can then add logic to use those values. When I run the code below I am only getting '10.0' as the output for every tick
Also, I know that I should have a parameter that differentiates between the upper and lower bands. When I searched for examples, they were using MODE_UPPER & MODE_LOWER in the iBands function. Although when I tried using the same I got an unknown value error.