Buy the specified spread.
Buy the specified spread. To set the quantity, use the sizeBy () method
var ndx = this.getSecurity("^NDX") val butterfly = ndx.strategies.butterflies.IronButterfly butterfly.buy().sizeBy.risk(targetRisk=10000)
Buy the spread.
Buy the spread. Specify an orderID in order to reference this position in the future. To set the quantity, use the sizeBy method.
To reference position using the orderID, use the selectPosition() API.
var ndx = this.getSecurity("^NDX") val butterfly = ndx.strategies.butterflies.IronButterfly butterfly.buy ("MyButterfly", "MyComments").sizeBy.risk(targetRisk=10000) this.selectPosition("MyButterfly");
Rank all matching spreads by criteria such as cost, risk / reward, etc.
Rank all matching spreads by criteria such as cost, risk / reward, etc..
Select the prior position to close.
Select the prior position to close. Roll into this new position after prior position is closed. If prior position is already closed, no rolling will take place.
Select the entire position in order to add specific criteria for overall position.
Select the entire position in order to add specific criteria for overall position.
Certain metrics will change based on the size of the position. For example, max risk / max reward / option greeks will scale up or down based on the size of the position.
If you don't want these metrics to be affected by the size of the position, set "scaleByQuantity=false"
If scaleByQuantity = false, metrics will be evaluated assuming quantity is 1.
Otherwise, metrics will be evaluated based on full position size.
Select the highest strike of the butterfly in order to add specific criteria for this strike
Select the highest strike of the butterfly in order to add specific criteria for this strike
// get highest strike of butterfly val highestStrike = putButterfly.selectHighestStrikeBy(false) // select highest strike to be between 45 to 55 delta highestStrike.deltaAbs(minDelta=45,maxDelta=55)
Select the lowest strike of the butterfly in order to add specific criteria for this strike
Select the lowest strike of the butterfly in order to add specific criteria for this strike
// get lowest strike of butterfly val lowestStrike = putButterfly.selectLowestStrikeBy(false) // select lowest strike to be between 45 to 55 delta lowestStrike.deltaAbs(minDelta=45,maxDelta=55)
Select the middle strike of the butterfly in order to add specific criteria for this strike
Select the middle strike of the butterfly in order to add specific criteria for this strike
// get middle strike of butterfly val middleStrike = putButterfly.selectMiddleStrikeBy(false) // select at-the-money (ATM) butterflies by selecting the middle strike of butterfly to be 45 - 55 delta middleStrike.deltaAbs(minDelta=45,maxDelta=55)
Select the Top N matching spreads based on the "rankBy" criteria used.
Select the Top N matching spreads based on the "rankBy" criteria used. Default is to select only the top (N=1)
Sell the specified spread.
Sell the specified spread. To set the quantity, use the sizeBy () method
var ndx = this.getSecurity("^NDX") val butterfly = ndx.strategies.butterflies.IronButterfly butterfly.sell().sizeBy.risk(targetRisk=10000)
Sell / short the spread.
Sell / short the spread. Specify an orderID in order to reference this position in the future. To set the quantity, use the sizeBy method.
To reference position using the orderID, use the selectPosition() API.
var ndx = this.getSecurity("^NDX") val butterfly = ndx.strategies.butterflies.IronButterfly butterfly.sell ("MyButterfly", "MyComments").sizeBy.risk(targetRisk=10000) this.selectPosition("MyButterfly");
Set the maximum number of open positions of this particular type of order
Set the maximum number of open positions of this particular type of order
Size all matching spreads by cost, risk, margin, etc.
Size all matching spreads by cost, risk, margin, etc..
Buy the spread.
Buy the spread. Quantity is ignored if specific "sizeBy" criteria are defined.
Buy the spread.
Buy the spread. Specify an orderID in order to reference this position in the future. Quantity is ignored if specific "sizeBy" criteria are defined.
To reference position using the orderID, use the selectPosition() API.
val cc = ndx.strategies.withStock.CoveredCall cc.buy(quantity=10,orderID="vertical1001",comments="Enter CoveredCall When 50 Day MVG crosses above 200 Day MVG") ..... ..... // select the covered call order using the orderID val coveredCall = this.selectPosition(orderID="vertical1001")
Select the entire butterfly position in order to add specific criteria for overall position
Select the entire butterfly position in order to add specific criteria for overall position
Certain metrics will change based on the size of the position. For example, max risk / max reward / option greeks will scale up or down based on the size of the position.
By default, computation will be evaluated based on full position size.
For example: select put butterfly with days to expiration between 1 to 4 days and risk / reward between 0.4 and 0.6
putButterfly.selectBy. daysToExpiration(minDays=1,maxDays=4). riskReward(min=0.4,max=0.6)
Sell / short the spread.
Sell / short the spread. Quantity is ignored if specific "sizeBy" criteria are defined.
Sell / short the spread.
Sell / short the spread. Specify an orderID in order to reference this position in the future. Quantity is ignored if specific "sizeBy" criteria is defined.
To reference position using the orderID, use the selectPosition() API.
val cc = ndx.strategies.withStock.CoveredCall cc.sell(quantity=10,orderID="vertical1001",comments="Enter CoveredCall When 50 Day MVG crosses above 200 Day MVG") ..... ..... // select the covered call order using the orderID val coveredCall = this.selectPosition(orderID="vertical1001")
Define a butterfly spread.
For example: