| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Array Out Of Range https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4617 |
Page 1 of 1 |
| Author: | Radar [ Fri Feb 19, 2016 4:07 pm ] |
| Post subject: | Array Out Of Range |
Hey Gang, I grabbed a few indicators the other day, and even though they work fine in the current version of Empty4, I thought I'd throw the old #property strict in to see what happens. Well, what happens is it compiles fine, but I end up with Array Out Of Range I've just spent the day trying to find the solution, but just got myself more confuzzled I think it has something to do with counting bars... Then again, I don't code indies all that much, so I could be pulling a hair out of my arm-pit Could some kind soul point me in the right direction with this? Thanks. Have fun! Radar =8^) |
|
| Author: | jlcgarcia [ Fri Feb 19, 2016 5:38 pm ] |
| Post subject: | Array Out Of Range |
Hi Radar, perhaps you could try this: Regards José Luis |
|
| Author: | Radar [ Fri Feb 19, 2016 8:58 pm ] |
| Post subject: | Array Out Of Range |
Thanks JLC I didn't bother with ArrayResize, because, according to the mql4/5 docs, buffers are supposed to be resized automatically. Both the original that I uploaded, and your modified one work fine until I add #property strict. It's just bugging me that I can't find how to rectify it. Take care, & Have fun! Radar =8^) |
|
| Author: | renexxxx [ Fri Feb 19, 2016 10:16 pm ] |
| Post subject: | Array Out Of Range |
Radar, I have just added #property strict and removed the compiler warnings, but I can not reproduce the Array Out of Index - error. What am I doing wrong? See attached. |
|
| Author: | Radar [ Sat Feb 20, 2016 1:40 am ] |
| Post subject: | Array Out Of Range |
Hey Renexxx, Thanks for taking a look-see I dropped it on several charts, in 3 separate instances of Empty4, and got the Array out of range error in the Experts log each time I commented out the #property strict, removed 2 declarations of int that the compiler complained about after that, dropped it on a chart, and it worked I can use it as is, but I'd rather make sure that it's compliant now, so that there'll be less to hunt down after the next update to mql4. Take care, & Have fun! Radar =8^) |
|
| Author: | Lowphat [ Sat Feb 20, 2016 7:17 pm ] |
| Post subject: | Array Out Of Range |
looking at the log it looks like it don't make it out of init. but it gets an array error beyond init. im guessing the issue would be the init trying to run a function to an array it hasn't setup yet. try commenting out the draw_objects in init Code: Select all |
|
| Author: | renexxxx [ Sat Feb 20, 2016 9:06 pm ] |
| Post subject: | Array Out Of Range |
Lowphat is right. You can not refer to an index buffer (v4[0]) in OnInit(), as it has not been initialized yet. |
|
| Author: | Radar [ Sat Feb 20, 2016 11:34 pm ] |
| Post subject: | Array Out Of Range |
Bewdiful! Nice spot, Lowphat Thank you, gentlemen, much appreciated. Take care, & Have fun! Radar =8^) |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|