BuyAtMarket not returning Position
Author: wouterv
Creation Date: 6/19/2011 7:24 AM
profile picture

wouterv

#1
Hi,

I'm trying to turn my stategy into a screener. So I run it on the latest bar (Bars.Count - 1), but when I get a signal and BuyAtMarket(bar+1) is called, it returns no Position object (null).

This I can also see in my PosSizer (which I'm also making applicable to a screener), when SizePosition is called, the first Position argument is null, rendering it useless for me, because I use Position.Tag to add additional info about the to-be-sized position.

Is this normal?
Do I do something wrong?

Thanks,
Wouter

profile picture

Cone

#2
A Position cannot be created on a future bar, so all BuyAt (and ShortAt) signals will return null in a screener and in all cases when the entry signal is an Alert.
profile picture

Eugene

#3
Regarding your PosSizer, please see the FAQ here:

How to pass a value from Strategy to PosSizer for Alert sizing?
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).