I would like to use multiple limit orders each one of them sized differently. What would be the way to do it using Tag (% Equity)? Is it possible to provide a code snipset? To be more precise, what I would like to do is the following: For a given symbol create 5 buy limit orders each one sized for example 1%, 2%, 3%, 4%, 5%.
Size:
Color:
Such code snippet is provided one the online help page:
Position OptionsI believe this is sufficient because the subject is utterly simple (assigning a
double value based on a condition).
Size:
Color:
I read this one but I am still having problems with the code. Apparently I haven't correctly understood how "Tag" really works. The example code assigns different values of % Equity to LastPosition whereas I want to assign different values of % Equity to different limit orders of the same symbol. Here is how I tried to use LastPosition.Tag unsuccesfully:
CODE:
Please log in to see this code.
Size:
Color:
After enabling "Use Tag" with "% Equity" selected, your code works exactly as planned. Of course, assuming that your strategy takes multiple positions.
Size:
Color:
I am afraid this is not the case. For example check with BAC for the past 15 weeks.
Size:
Color:
Precisely, what should I find? Be verbose please.
Size:
Color:
Also, for EOD strategies that use this design, you must ensure that the priority of the signals are correct. In other words, the signal hitting the 5% target should be sized before the one for the 6% dip, and so on. Here's a looping construction with the proper setting of priority.
CODE:
Please log in to see this code.
Size:
Color:
Priority setting was the problem. Thanks a lot for your help.
Size:
Color:
I just found another problem while using this design. Although the strategy is correctly backtested the alerts generated are not correctly sized. Each one of these are sized with the exact same % of equity.
Size:
Color:
This is by design. Script-based percent equity can't be used for alert sizing. The situation is explained in this FAQ, with a workaround (requiring you to code a custom PosSizer):
How to pass a value from Strategy to PosSizer for Alert sizing?To clarify things further, as the
Position object is null for alert sizing, the "Use Tag" feature is limited to the sizing of historical trades. Since Alert size can not be determined, the PosSizer has to fall back to a default value specified in its settings (e.g. 5% equity). On a closing note, the Bars.Tag workaround from the FAQ will not be included in "Position Options" to avoid over-complication.
Size:
Color:
Eugene, thanks a lot for your detailed reply.
Size:
Color:
Size:
Color: