-
SetIndexBuffer(0,ExtOBuffer,INDICATOR_DATA); SetIndexBuffer(1,ExtHBuffer,INDICATOR_DATA); SetIndexBuffer(2,ExtLBuffer,INDICATOR_DATA); SetIndexBuffer(3,ExtCBuffer,INDICATOR_DATA); SetIndexBuffer(4,ExtColorBuffer,INDICATOR_COLOR_INDEX); ⋮ if(prev_calculated==0) { ExtLBuffer[0]=low[0]; ExtHBuffer[0]=high[0]; ExtOBuffer[0]=open[0]; ExtCBuffer[0]=close[0];
-
You haven't indicated that the buffers and arrays are being accessed non-series.
-
Buffers are automatically size, are as-series, and elements are moved for you, new elements are set to EMPTY_VALUE (or your designated. They can also draw on the chart automatically.
-
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
-
In MT5, you must set the direction.
To define the indexing direction in the time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[] arrays, call the ArrayGetAsSeries() function. In order not to depend on defaults, call the ArraySetAsSeries() function for the arrays to work with. Event Handling / OnCalculate - Reference on algorithmic/automated trading language for MetaTrader 5
-
-
if(CopyBuffer(handle_harsi_high,0,shift,1,value)>0)
-
What direction is a shift of zero here? What is your caller expecting?
- Why create separate functions when you can us iClose, etc.?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I was trying to convert this indicator from TradingView to MQL5 but it badly prints the candles, as in the attached photo, and i don't understand where is the problem.
From the TradingView indicator i want to convert only the Heiken Ashi code, not RSI and Stoch lines.
Here there is the code:
Thank you