Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. 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

How to Build Put Call Ratio Chart in Amibroker?

1 min read

This tutorial explores how to build Put Call Ratio (Open Interest) chart in Amibroker for the any given Option Instrument. Since creating a PCR chart involves multiple Option Strike price and it is a composite indicator it can be achieved in Amibroker using Addcomposite function.

About Addcomposite Function

Bascially the concept behind AddToComposite is that we run our afl code (using Scan feature) through a group of symbols performing some calculations. We will compute some multiple security statistics and store the results in the artificial ticker created using AddToComposite function.

Requirements

Before building the PCR(OI) composite indicator here are some of the prerequisites

1)Amibroker Trial/Licensed Version
2)Realtime Data Subscription / IEOD data for NSE Future and Options Segment which supports Open Interest Data.
3)Knowledge to Create Watchlist and Scanning in Amibroker.

July PCR Chart below July Futures Price Chart
July PCR

What to Calculate in the Composite Indicator?

1)We need to calculate the Total Open Interest of Call for the particular option series and push it to the Artifical Ticker ~niftyoice
2)1)We need to calculate the Total Open Interest of puts for the particular option series and push it to the Artifical Ticker ~niftyoipe
3)Now divide ~niftyoipe/~niftyoice and plot the results on the charts.

Aug PCR Chart below Aug Futures Price Chart
Aug PCR

Steps to Create Put Call Ratio Chart

1)Creating Watchlist

Create a Watchlist with the Strike Price of Option symbols belongs to the same series(includes PE and CE as shown below). For Ex push all the Nifty Option symbols of August 2014 series in a watchlist. (Manual Work takes lots of efforts the best way is to use the search function and select the list of option symbols and push it to the watchlist).

Nifty Watch List

[wp_ad_camp_5]

2.Install the Indicator
i)Download Put Call Ratio – Amibroker AFL code
ii)Unzip Put-Call-Ratio-OI.afl_.zip to local folder
iii)Copy Put-Call-Ratio-OI.afl file to \\program files\\amibroker\\formula\\basic folder
iv)Open Amibroker and Open a New Blank Chart
v)Apply Plain Candle stick chart
vi)Insert PCR chart below the Plain Candle Stick chart (you dont see any charts until you perform scan)

3)Perform Scan

i)Open New Analsis and Select the Put-Call-Ratio-OI.afl file from \\program files\\amibroker\\formula\\basic folder.
ii)Set the timeframe to hourly

Scan Settings

iii)Set the filter settings as shown below. In this example Nifty August series watchlist is selected.
Nifty Filter Settings

iv)Now Press the Scan Button. This attempt will create the Artificial symbols ~niftyoice and ~niftyoipe

Now get back to the chart and you should be able to see the Nifty futures candlestick chart along with the August PCR chart below the nifty futures price chart. You can perform an auto scan to update the PCR chart at regular scanning intervals.

//Create by Rajandran R
//Date : 31st July 2014

_SECTION_BEGIN("PCR OI");

//if( Status("actionScan") ==1 ) 
//{

if( StrFind( Name(), "CE" ) )
{
   AddToComposite( openint, "~niftyoice", "I" );
} 

if( StrFind( Name(), "PE" ) )
{
   AddToComposite( openint, "~niftyoipe", "I" );
}

//} //endif

PCR = Foreign( "~niftyoipe", "I" )/Foreign( "~niftyoice", "I" ); 
Plot(PCR,"PCR",colorRed,styleLine);



_SECTION_END();
Rajandran R Creator of OpenAlgo - OpenSource Algo Trading framework for Indian Traders. Building GenAI Applications. 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

CUSUM Filter Strategy in AmiBroker AFL: A Practical Implementation

Detecting meaningful shifts in price trends while filtering out market noise is a challenge many traders face. Inspired by Jakub Polec’s blog, which applies...
Rajandran R
2 min read

Fisher Transform – Amibroker AFL Code

The Fisher Transform is a technical analysis indicator developed by John F. Ehlers, designed to identify potential turning points in the price movements of...
Rajandran R
2 min read

My Experience Converting SSL Hybrid from PineScript to Amibroker…

As a trader and coding enthusiast, I often find myself needing to translate trading indicators from one programming language to another. Recently, I embarked...
Rajandran R
8 min read

18 Replies to “How to Build Put Call Ratio Chart in Amibroker?”

      1. Dear Sir,

        Kindly give your value advises and how to load amibroker how to catch the market for new traders (Most of the people are loosing money). give any video demo in your site, please …. Prem

  1. I did all the settings as per your above instructions. After having 3 candles on hourly chart, I pressed Scan button, but I am getting error “Missing buy/sell variable assignments”.
    Please inform for possible solution to this.

  2. Sir,

    Could you please let me know, how to configure NSE Option EOD into Metastocks?

    Many Thanks

  3. Sir,
    Is there any possibilities of having a seminar in Mumbai on “How to Build Put Call Ratio Chart in Amibroker?
    Please advice.
    May God Bless you.

  4. sir i m also a b.tech student like u was ec branc n in final year i m a new trader can u please let me know
    how to use amibroker i dont know anything about it and some afl code how to start it please i will be obloged to u if u do so..

  5. dear sir i m new trader in mcx will u pls tell how i can load amibroker & how i can use it in my trading & how amibroker generate sell/buy signal

  6. SIR , I AM GREAT FULL TO YOUR WANDER FULL RESEARCH TEEM , THANKING YOU SO MUCH .

  7. is it possible to build any custom ticker based on multiple (regular) symbols.

    Lets say I want to create my own index chart which consist of 10 symbols (for simplicity we consider all with same weightage as of now) . is it possible to create an index based on these 10 symbols name it TenX ?? where TenX = sum of all 10 securities last price in a watch list / 10 ..

    I want to plot this index separately on a different window without opening those 10 charts ..

    Kindly guide me if possible.

Leave a Reply

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