- ago
Hello I would like to Know the equivalent WL6 pos size(variable % Equity using Tag):

BuyAtMarket(bar + 1);
LastPosition.Tag =porcent_stock ; // double porcent_stock is different each trade

I did configure Position size (WL6) like this:



How Can I do it in WL7??
Thank you very much!
0
1,081
Solved
1 Replies

Reply

Bookmark

Sort
- ago
#1
Although there is no direct replacement for passing a percent equity value, you can already set a share size straight from your Strategy code. PlaceTrade returns a Transaction object with Quantity property holding the number of shares in the transaction, and which can be modified to customize the position sizing out of the box:

CODE:
PlaceTrade(bars, TransactionType.Buy, OrderType.Stop, Highest.Series(bars.High, 20)[idx]).Quantity = 100;


It acts like "WealthScript Override" (SetShareSize) but unlike WL6 you have built in access to the portfolio equity in your Strategy code through CurrentEquity so a % Equity is a piece of cake to accomplish:

CODE:
var tenPercentEquity = CurrentEquity * 0.1 / bars.Close[idx]; PlaceTrade(bars, TransactionType.Buy, OrderType.Stop, Highest.Series(bars.High, 20)[idx]).Quantity = tenPercentEquity;
1
Best Answer

Reply

Bookmark

Sort