You can create a custom position sizing method that can account for multiple factors (risk, quantity, credit, etc) when sizing a trade.
1) Create a custom position sizing function. This function should return the number of contracts to trade, based on various trade attributes such as max risk, max quantity, etc.
// create your custom position sizing function based on max risk / quantity
def mySizingFunction (trade:LegCriteriaT):Double = { }
2) Set the custom position sizing function when constructing your trade:
// set the custom sizing function
strategy1.sell("PutVertical", "Enter").sizeBy.customSizingFunction(mySizingFunction)
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory or other services by OptionStack. In addition, the content of the website offers no opinion with respect to the suitability of any security or any specific investment. There are no guarantees as to accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. Past performance is no indication or guarantee of future results. All investments involve risk – including loss of principal. You should consult with an investment professional before making any investment decisions.