You can absolutely produce such an image with your script when you overwrite trade parameters with data from wrong assets. Programming is not foolproof - you can do anything with any variable, no matter if it makes sense or not. Garbage in, garbage out.

Your single asset TMF makes some sense to me, but I do not understand the purpose of your multi asset version. Delete it and start over. Think about what parameters you want to change - then program just that, preferably without "while", "loop", "asset", or similar stuff, and without overwriting other trades. If you are not sure how to do it, just ask here. if you get strange results, you can normally easily find out why - use the single step mode and watch all variables in question.