-
pmarArr[i]=MathAbs(close[i]/VWMAArr[i]);
-
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 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
-
-
for(int i=0;i<rates_total;i++)
You are recalculating all bars every tick.
See How to do your lookbacks correctly #9 — #14 & #19. (2016)
Thank you for the advice! I'll read the articles and try to implement the changes. Appreciate it.
-
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 MT5, you must set the direction.
-
-
You are recalculating all bars every tick.
See How to do your lookbacks correctly #9 — #14 & #19. (2016)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have transferred an indicator that is open source from pinescript to MQL5. The indicator works 99% of the time as intended however at times when it has been left for a while, the calculation seems to not be correct until it is refreshed starting the Oninit process over. At that point the values and indicator graphic match with the pinescript version. My knowledge of MQL5 is still low level so I know my code is not perfect but I would be really grateful for any advice/ criticism of my code and how to improve it's function, readability and/or efficiency. Ive attached both the pine and MQL5 versions below.