Thanks to Herman and Rajiv Arya for helping with my previous problem. It is great that there is a forum like this where beginners can get help.
I noticed that after I use setforeign() and restorepricearrays() the buy and sell price get set to open (I have put both to close in settings). Is this a bug or is there some logical reason for this? It is rather sneaky since backtest profits improve a lot because of this. The workaround is of course to define buyprice and sellprice in the code after restorepricearrays().
