How to find the specified Margin Factor programatically?
Author: sl44096
Creation Date: 8/28/2016 6:02 PM
profile picture

sl44096

#1
Hi...

Take this simple case: A default Portfolio Simulation Mode where I'm running 10% of Equity per Position, and I have the Margin Factor set to 1.1 to 1 (via the UI).

Is there a way, in the "Execute" method of a strategy script, to determine that Margin Factor? I simply want to print out that value (1.1) in a report, for future reference, as part of a simulation run...

It's not a big deal, but if that's somehow available, it would be nice!

Thanks, Lee
profile picture

Eugene

#2
Hi,

This question was asked before. There's nothing new under the sun:

Margin-Factor in Wealth-Script

Now that we've got GetPositionSize in Community Components it gets more elegant:

CODE:
Please log in to see this code.
profile picture

sl44096

#3
Works like a charm. Thanks....

Now... can you just point me to that new strategy component that will guarantee 100% annualized returns? The one with no draw-down? :-)

profile picture

Eugene

#4
Sure, BuyAtLimit(bar,Low[bar]) together with SellAtLimit(bar,High[bar]) should do that nicely... for some reason only before the hard right edge. :)