Hello,
how can I access Margin factor in WealthScript?
BR,
akr
Size:
Color:
This is not a use case, and getting the value is pretty tricky but possible. It's a part of the "PositionSize=..." config string in
WealthLabConfig.txt:
CODE:
Please log in to see this code.
Size:
Color:
OK, with this code I can read the value of MarginFactor, but how can I change inside my Script.
MarginFactor = 1.5;
Does not really influence the MarginFactor.
Thank you and BR,
akr
Size:
Color:
The code is getting the Margin Factor - as indicated above.
Setting it this way is even more unsupported than getting. I don't know if setting it through SettingsManager.Set in a strategy would work, but what I know is that attempting to change this value can potentially lead to unexpected results because it will get in the way of Wealth-Lab working with its configuration file.
Size:
Color:
Is it possible (how) to set the PositionSize (Percent of Equity) in Wealth-Script?
Size:
Color:
A fixed share amount can bet set through SetShareSize - but not Percent of Equity. Theoretically, you can keep track of portfolio equity in your Strategy (using a DataSetSymbols loop), and use SetShareSize to set a computed fixed share amount. Alas, it's easier said than done.
But why would you need that? Maybe we can suggest a better way.
Size:
Color:
In my Strategy, I want reduce Risk if the Vola is as high as at Moment, or if the trend gets broken,.... Normally I use a Marginfactor of 2.
So I thought I try to reduce the Marginfactor if something with the uptrend goes wrong.
Maybe it is also possible with SetShareSize?
I always have 5 Positions open, that means if the Marginfactor is set to 2, the percent of equity is 40 (if Marginfactor is 1 -> percent of equity is 20).
Do you think, is this possible with DataSetSymbols loop?
Is there a small example available?
Thank you,
akr
Size:
Color:
Can't suggest any example of using DataSetSymbols to create a portfolio equity series, sorry.
If you're not looking for dynamically increasing/reducing the current position size with volatility/risk, then I'd suggest coding a PosSizer that would vary the position size from a normal percentage (i.e. 40%) to reduced (20%), when the volatility gets high or {insert a condition here}.
Size:
Color:
On a second thought, I think this PosSizer is already coded:
Position Sizing with the Trend1. In your strategy code, define a condition when reduced position size (20%) will be used - a high volatility condition, trend gets broken etc. When it's time to enter a position, use the Position.
EntrySignal property to mark the entry signal somehow e.g. "normal" and "reduced".
2. In the PosSizer's GUI, check "Or use these EntrySignals..." and enter your signal names.
Note: This is going to work as expected for a system that takes only long (or only short) positions; otherwise you need to code a PosSizer.
Size:
Color:
Thank you for help Eugene.
I will try it tommorow.
Size:
Color: