GetExternalSymbol in PosSizer
Author: ruediger78
Creation Date: 5/13/2014 11:21 PM
profile picture

ruediger78

#1
I want to create a Possizer in VisualStudio.

The size of the position should be depending of an Indicator Value of the "SPX"-Symbol. How can I access the SPX-Bars? Can I use GetExternalSymbol for that? If so, I dont know how, because GetExternal Symbol is Wealth Script
profile picture

Eugene

#2
No, GetExternalSymbol can't be used for that. You can assign the indicator's value to the Tag property of the last established Position:

CODE:
Please log in to see this code.

Then in your PosSizer, read that value back from the currentPos.Tag to size your Position:
CODE:
Please log in to see this code.


This scheme won't work for Alert sizing because currentPos is null for Alerts. In this case, you can use the following workaround:

How to pass a value from Strategy to PosSizer for Alert sizing