EDIT: This is your fix as a result of Johnvanwijk! Https://www.forexforum.co.za/general...-analysis.html
Hey men,
So I've been trying to draw some things however it's giving me the error Array from range.
It pulls the green arrows absolutely however that the red arrows just won't function.
If somebody could tell me exactly what I'm doing wrong it would be fantastic.
It is not because I'm trying to access candles that are not there or at all as far as I know.
I get that some people might say that it's going past available bars but I have tested even with a limit of 1000 which I'm convinced my chart has and it still gives me from range.
Here is the code:
Inserted Code // ------------------------------------------------------------------ //| FractalsExercise.mq4 | //| | //| https://www.mql5.com | //p------------------------------------------------------------------ #property copyright #property link https://www.mql5.com #property version 1.00 #property strict #property indior_chart_window double Highs#91;#93;; dual Lows#91;#93;; // ------------------------------------------------------------------ //| Custom indior initialization function | // ------------------------------------------------------------------ int OnInit() //-- drawing style SetIndexStyle(0, DRAW_ARROW, EMPTY, 1, clrGreen); SetIndexArrow(0, 234); SetIndexStyle(1, DRAW_ARROW, EMPTY, 1, clrRed); SetIndexArrow(1, 233); //-- indior buffers SetIndexBuffer(0, Highs); SetIndexBuffer(1, Lows); //-- return(INIT_SUCCEEDED); // ------------------------------------------------------------------ //| Custom indior iteration serve | // ------------------------------------------------------------------ int OnCalculate(const int rates_total, const int prev_calculated, const datetime time#91;#93;, const double open#91;#93;, const double top#91;#93;, const double non#91;#93;, const double close#91;#93;, const extended tick_volume#91;#93;, const long volume#91;#93;, const int disperse#91;#93;-RRB- //-- int I = 1; int ii = 1; int Restrict = Bars - 1; while(I lt; Restrict) if(High#91;t#93; gt; High#91;t 1#93;-RRB- if(High#91;t#93; gt; High#91;I - 1#93;-RRB- Highs#91;I#93; = High#91;I#93;; I ; while(ii lt; Restrict) if(Low#91;ii#93; lt; Low Cost#91;ii 1#93;-RRB- if(Low#91;ii#93; lt; Low Cost#91;ii - 1#93;-RRB- Tip#91;ii#93; = Low#91;ii#93;; ii ; //-- return value of prev_calculated for next call return(rates_total); // ------------------------------------------------------------------
Thanks!