Originally Posted By: jcl
If the purpose was just setting a trailing stop, there are several examples in the manual.


It's a little more complex than that. First of all, if the trade goes against me, I increase my position, lowering the average entry price. A trail is only set once priceClose moves above the average entry price.

The code works perfectly for just one asset, as I showed in the previous post. I'm doing something wrong though when I add in multiple assets.

In addition, it still doesn't make sense to me why Zorro would ever have me exit a trade at a price significantly higher than the high of that day, or significantly below the low of a day. Regardless how flawed my code is, that shouldn't happen. No matter what I did in live trading I could never sell my position way above the high of the day, so in that manner zorro is not accurately simulating live action. Just look at that image I posted earlier!