Using .Tag to Size Positions in Position Options
Author: tradertabb
Creation Date: 5/8/2012 12:32 PM
profile picture

tradertabb

#1
I am trying to use the .tag option in the Position Sizing Options.

I want to use different risk percentages on different markets.

First I established a variable for the first two letters of the symbol:
CODE:
Please log in to see this code.


Then I attempted to copy and paste the code from the WL Wiki after my signal instructions:

CODE:
Please log in to see this code.


I get the error: CS0117 @ 159, 19 ‘int’ does not contain a definition for ‘Tag’

Any help greatly appreciated.
profile picture

Eugene

#2
In this context, the only reason for this odd error message is trying to mix code generated by WealthScript Translator (WSTL) with pure WealthScript, or editing WSTL code. This is not going to work. Mixing WSTL output with WealthScript is not endorsed/supported.

P.S. Not sure if having two topics on using .Tag in Position Options makes the forum better, but since we have it, here's a related topic:

Use Tag in Position Options
profile picture

Eugene

#3
P.S. Just to clarify, in plain English:

For the benefit of legacy users migrating from WL4 to WL5, the WSTL designers maintained types between the platforms as closely as possible.

WSTL output requires the WealthScript Translator library to run. Although it looks like WealthScript, it's NOT.

In WSTL, a Position object (e.g. LastPosition) is of type integer. In C#, integer numbers do not have a .Tag.

That's why playing with WSTL output is doomed to fail.
profile picture

tradertabb

#4
Thank you for the clarification. I will attempt to rewrite my code from scratch and then try the TAG code.
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).