@Ambi123,
Did you know that you have a preview on the right side of forum editor before you insert a post? Besides you have 15(!) minutes time to correct a post.
It is beyond me that there are still people who just do not bother for proper post format.
Why should we bother for help then?
Anyway a proper way of reading from text file has been shown in Knowledge Base (click it!) of AmiBroker already. SetPositionSize function rather should be placed outside of loop as seen in KB article as it is taking array as 1st argument.
... other flaws and errors in your code not been looked at (or rather not bothered for)...