- ago
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.
0
248
Solved
6 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.85% )
- ago
#1
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
0
Best Answer
- ago
#2
Thanks for the response Glitch. Do you mean simply scale the positions in the Buy/Short entry orders?
0
Glitch8
 ( 10.85% )
- ago
#3
When you say scale what do you mean exactly, can you give an example?
0
- ago
#4
Let's say if I want to go long multiply share count by 1.1 and if short by 0.9 for example.
0
Glitch8
 ( 10.85% )
- ago
#5
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.
0
- ago
#6
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
0

Reply

Bookmark

Sort