Sell code before buy code in template
Author: RickTg
Creation Date: 10/23/2015 1:03 PM
profile picture


I have searched the forum but could not find an answer. Maybe I was looking in the wrong places!

Why? is the sell code before the buy code in the template?

I am sure that there is a good reason.

profile picture


I believe this is to prevent peeking into the future i.e. creating a Strategy that evaluates the results of a trade on the current bar that may (or may not) occur on the next bar. If you test a Position's active status before executing a trading signal, you avoid that.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).