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

RickTg

#1
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.

Rick
profile picture

Eugene

#2
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.