Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Strangle and Straddle Option Spread – Amibroker AFL code

1 min read

The Complete March month Marketcalls decided to focus more on Implementing Option Strategies in Amibroker. As a kickstart thought of coding simple concepts before turning out with Complex Ideas. As an initiative thought of starting with implementing Option Spreads with Strangle and Straddle.

If you are an Options Strategic Player then probably you would be interested in monitoring the Option Spread in Realtime. However a time series option spread is even more interesting. The below image shows the Option Spread of 6000CE + 6400CE long straddle strategy for march option series.

options Spread
[wp_ad_camp_5]
_SECTION_BEGIN("Strangle and Straddle Spread");
SetChartOptions(0,chartShowArrows|chartShowDates);

_N( Symbol1= ParamStr("Strike1", "NIFTY14MAR6000CE") );

SetForeign( Symbol1 );
C1 = C;
H1 = H;
L1 = L;
O1 = O;
V1 = V;
RestorePriceArrays();


_N( Symbol2= ParamStr("Strike2", "NIFTY14MAR6400CE") );

SetForeign( Symbol2 );
C2 = C;
H2 = H;
L2 = L;
O2 = O;
V2 = V;
RestorePriceArrays();

Color = ParamColor( "Color", colorDefault );
Style = ParamStyle( "Style", styleLine, maskPrice );


PlotOHLC( O1+O2, H1+H2, L1+L2, C1+C2, "(" + Symbol1+" + "+Symbol2 + ") spread", Color, style );

_SECTION_END();

Procedure to Setup the Strangle and Straddle Option Spread

Properties

1.Download Strangle and Straddle Option Spread AFL code to Amibroker/Formulas/Options Spread directory
and Unzip the file. Create Options Spread Directory if it doesn’t exist.
2.Open Amibroker->Open New Blank Chart
3.Now on the Left Pane goto Charts->Option Spread and drang and drop Strangle and Straddle Spread to the blank chart.
4.Bingo! you got the Spread chart.
5.To Change the spread right-click over the charts and goto Parameters where you have control to change the strike1 and strike2 prices as shown below

What Strategies are covered in the AFL Code?
1.Long Strangle – Volatility Strategy
2.Long Straddle – Volatility Strategy
3.Short Straddle – Neutral Strategy
4.Short Straddle – Neutral Strategy

Prerequisite
Realtimedatafeed for Amibroker which Supports NSE Options.

Every day we are planning to release a set of Option spread strategies. Put you ideas to bring more stuff here. Stay Tuned!

Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Building Algo Platforms, Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in

Interactive Brokers – Smart Order Chart Trading Module using…

The IB Controller is an interface designed to facilitate automatic trading with AmiBroker and Interactive Brokers (IB) TWS (Trader Workstation). It serves as a...
Rajandran R
8 min read

Introducing OpenAlgo V1.0: The Ultimate Open-Source Algorithmic Trading Framework…

OpenAlgo V1.0 is an open-source algorithmic trading platform to automate your trading strategies using Amibroker, Tradingview, Metatrader, Python etc. Designed with the modern trader...
Rajandran R
2 min read

[Live Coding Webinar] Build Your First Trading Bridge for…

In this course, you will be learning to build your own trading bridge using Python. This 60-minute session is perfect for traders, Python enthusiasts,...
Rajandran R
1 min read

10 Replies to “Strangle and Straddle Option Spread – Amibroker AFL code”

  1. Yes, It is a good start. But you know these kind of option strategies also hit SL sometimes. Why do you not consider the OI change in Options considered in these type of strategies and define something accurate by more than 95% in options. Till now, we use your super trend in sell side of options.However it working great, we did observe returns in terms of % looks lesser. Any how it is a new beginning in options. Hope we can expect more from your group on this. If possible we will be ready to share our ideas as well.

  2. I want to Configure AFL code in AMI Software for Auto Buy Sell Signal indicator with price… with Help…

  3. Thanks for the post. Very informative and nicely written. Instead of selecting the pre-defined option, can I programmatically select an option in AFL based on some other condition like moving average cross over on Nifty. I am trying to implement this in an AFL. I wanted to know if its doable.

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More