Is there a way to scale the final share count determined by a builtin position sizer? I want to scale long and short sizing differently.
Rename
There are two ways:
1. In a C# coded strategy use code logic to set the Quantity of the Transaction instances
2. Use a custom Position Sizer
1. In a C# coded strategy use code logic to set the Quantity of the Transaction instances
2. Use a custom Position Sizer
Thanks for the response Glitch. Do you mean simply scale the positions in the Buy/Short entry orders?
When you say scale what do you mean exactly, can you give an example?
Let's say if I want to go long multiply share count by 1.1 and if short by 0.9 for example.
My approach would probably be to assign the Quantity to the Transaction instances that you get when you call PlaceTrade. That way you have full control over the position size.
Please make corrections to the code below if it's wrong. I haven't tried it.
CODE:
Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.Market, 0, "long buy"); t.Quantity = t.Quantity * ((t.PositionType == PositionType.Long)? 1.1 : 0.9); // t.Quantity *= t.PositionType == PositionType.Long ? 1.1 : 0.9; //alternatively
Your Response
Post
Edit Post
Login is required