Assuming that you have created your first simple strategy from reading the previous blogs, let us know understand how to implement a multi-leg strategy and how you can take action on specific legs.
What is a Multi-leg strategy? A multi-leg strategy is any strategy which takes positions simultaneously, in different instruments at the same time for one single entry condition
For example a Long Strangle
Long Strangle: A strangle is an options strategy where the investor holds a position in both a call and a put option with different strike prices, but with the same expiration date and underlying asset. A strangle is a good strategy if you think the underlying security will experience a large price movement in the near future but are unsure of the direction. However, it is profitable mainly if the asset does swing sharply in price.
You can read all about a Strangle in detail here
Now, before we begin making this strategy, we need to understand three advanced keywords in Tradetron
- Traded Instrument
- ATM
- Position Detail
1. Traded Instrument: This keyword takes the following inputs
- Condition Type
- Field
- Underlying
- Set Number
- Condition Number
- Leg Number
And returns the corresponding value of the Field you select.
We will understand this later in the example
2. ATM: This keyword takes the following inputs
- Underlying
- Atm +/- N Step(s)
And returns the value of strike price, steps above or below from the At the money.
We will understand this later in the example
3. Position Detail: This keyword takes the following inputs
- Condition Type
- Transaction Type
- Instruments Type
- Value/quantity
- Underlying
And returns a value corresponding to the position you have already taken.
We will understand this later in the example
Now, let us first define the entry condition for our strangle
Entry: When the market opens [Between 9:15 and 9:20], we want to buy one out of the money call and one out of the money put with same expiry but different strike prices as mentioned earlier.
For this example, let us assume, that we use Nifty 50 as the underlying.
This is how our Entry condition will look like
While creating the positions, we will select the option details, however, in strike field you will select FX from the drop down and click FX next to it to open Formula Builder.
Formula Builder helps you use the ATM keyword which in turn helps you select specific out of the money strikes for your options
Now, the step size is in digits i.e. 1,2,3... for calls is out of the money and
-1,-2,-3... for puts is out of the money
where as negative step size is in the money for calls and positive steps for put is in the money
We will select 2 steps out of the money for both call and put for our position
Exit: For exit we want to remove either of the legs if it hits a stop loss of 5%
This is where the Repair block helps us. The Repair block helps us partially modify an existing entered position.
Hence for each leg call/put, we will have an independent Repair block.
Since we want to only remove once, we will use Repair once. If in a different perspective we wanted to continuously modify the position, we would use Repair continuously.
In the first Repair, we will remove the call if it hits a stop loss of 5%
For this, we will need the help of Traded Instrument and Traded Instrument Name keywords to fetch the entry price, name and expiry of a specific leg
Notice how Set Number, Condition Number and Leg Number is 1. This is because the position in call option we took, occurs in Set no1, condition no1 and leg no1
And the Traded Instrument name when used inside LTP keyword will fecth the last traded price of the exact call option we took position in for the strike price and expiry.
Then it is a simple matter of math operation to check the stop loss
We are not done yet.
in the position builder of the Repair block, we will mention the opposite of the call to square it off
But this time in the strike, we want the same strike price as what we entered, hence, we will again open the formula builder and select Traded Instrument keyword and select Strike in the field which will return the strike price of the call option we took position in
Similarly, in the second Repair block, we will set the condition for put.
Notice how, how Set Number, Condition Number and Leg Number is now 1,1,2 as the put also resides in Set number 1 but as leg no 2
Similarly, we build the position for second repair block as we did for the call option with Traded instrument in Formula builder with Strike as the value and leg no as 2
Finally we can mention our universal exit and the strategy is ready
But wait! what if we want to remove the first leg which hits the stop loss and continue with the second till the universal exit.
For example, let us assume that the call option hit the stop loss 1 hr after entry and we dont want to the second repair(sell put) to trigger even if it hits stop loss
Or, we hit stop loss on the put first and we want to continue with the call till universal exit, how would we do that.
This is where the position detail keyword helps us
At any given time after the entry position is taken, The Position Detail keyword will return the total quantity of open positions
Now we know that 1 Nifty option lot size equals 75, and when we went long 1 call and 1 put the total size is 150
Hence we will use the position details keyword inside both the Repair conditions and set it equal to 150 and connect the conditions with Logical AND
When means, the repair conditions will only trigger when the leg hits the stop loss and the current positions we have taken equals to 150
Hence, when one leg gets squared off, the quantity will reduce to 75 and the second repair condition will not trigger.
This how you use the Traded Instrument and Position detail keyword to selectively operate on specific legs you hold in the entry position
For any queries, please write to us at [email protected]