My indicator won't show on my charts I tried everything. I also don't know if "return false; is correct at the end
- Zee Al:
You posted no question. Title does not count.
-
int OnCalculate(… ) { ⋮ swingHighBuffer[i] = EMPTY_VALUE; swingLowBuffer[i] = EMPTY_VALUE; } } return false; }
The function returns an int, not a bool.
How to do your lookbacks correctly #9 — #14 & #19 (2016) -
double highPrice = high[i]; double lowPrice = low[i]
In MT4, buffers and MT4 predefined arrays are all ordered AsSeries. There is a difference between the arrays passed to OnCalculate (e.g. low[]) and the MT4 predefined variables (e.g. Low[].) The passed arrays have no default direction, just like MT5.
To determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use