Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

Bear Call Spread and Bear Put Spread – Amibroker AFL code

1 min read

What is Bear Call Spread?

Investopedia defines “A type of options strategy used when a decline in the price of the underlying asset is expected. It is achieved by selling call options at a specific strike price while also buying the same number of calls, but at a higher strike price. The maximum profit to be gained using this strategy is equal to the difference between the price paid for the long option and the amount collected on the short option.”

BCS

Bear Call Spread (6000CE-6400CE)
Bear Call Spread

 

Visit here for Nifty Option Live Charts

What is Bear Put Spread?
A type of options strategy used when an option trader expects a decline in the price of the underlying asset. Bear Put Spread is achieved by purchasing put options at a specific strike price while also selling the same number of puts at a lower strike price. The maximum profit to be gained using this strategy is equal to the difference between the two strike prices, minus the net cost of the options.
BPS

Bear Put Spread(6400PE-6000PE)
Bear Put Spread

Procedure to Setup the Bear Call Spread and Bear Put Spread

1.Download Bear Call and Bear Put 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->File->Open New Blank Chart
3.Now on the Left Pane goto Charts->Option Spread and drag and drop Bear Call Spread and Bear Put 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

Bear Put Spread Settings
Bear Put Spread Settings

What Strategies are covered in the AFL Code?

1.Bear Call Spread – Neutral to Bearish Strategy.
2.Bear Put Spread – Bearish Strategy.

Prerequisite
Realtimedatafeed for Amibroker which Supports NSE Options.

Visit here to download Strangle and Straddle Option Spread – Amibroker AFL code

Rajandran R Founder of Marketcalls and Co-Founder Algomojo. Full-Time Derivative Trader. Expert in Designing Trading Systems (Amibroker, Ninjatrader, Metatrader, Python, Pinescript). Trading the markets since 2006. Mentoring Traders on Trading System Designing, Market Profile, Orderflow and Trade Automation.

How to Install Amibroker and Ninjatrader on MacBook Air

This is a routine question we get from Mac users and in this tutorial, we will be learning how to install Windows 11 inside...
Rajandran R
49 sec read

What is Algomojo – Smart Order Execution Module for…

Smart Order Module brings a 100% end-to-end automated trading solution for Amibroker users to automate their trading ideas with a simple plug-and-play module. Traders...
Rajandran R
26 min read

Virtual Trade Simulator Module Version 1.0 – Amibroker AFL…

Thought of launching a simple and user-friendly Virtual Trade Simulator to study/test your inner intuition before practicing in the live markets. Virtual Trade Simulator...
Rajandran R
3 min read

One Reply to “Bear Call Spread and Bear Put Spread – Amibroker…”

  1. Hi,
    Its a very helpful piece of code. I am trying to create alert when a certain level is hit in the code. But the alerts are not popping out. Here is the code.

    _SECTION_BEGIN(“Bear Call and Bear Put Spread”);
    SetChartOptions(0,chartShowArrows|chartShowDates);

    _N( Symbol1= ParamStr(“Sell Strike”, “BANKNIFTY05AUG2133700PE.NFO”) );

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

    _N( Symbol2= ParamStr(“Buy Strike”, “BANKNIFTY05AUG2134300PE.NFO”) );

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

    Color = ParamColor( “Color”, colorRed );
    Style = ParamStyle( “Style”, styleCandle, maskPrice );
    SlLevel = Param(“SL Level”, 0,0,10000);

    PlotOHLC( (1*O1-1*O2), (1*H1-1*H2), (1*L1-1*L2), (1*C1-1*C2), “(” + Symbol1 + ” – ” + Symbol2 + “) spread”, Color, style );

    _SECTION_END();

    SlAboutToHit = (GetRTDataForeign(“Last”, Symbol1) – GetRTDataForeign(“Last”, Symbol2)) > SlLevel;
    AlertIF( SlAboutToHit, “SOUND “, “SL Alert”, 15 );

    _N(Title = StrFormat(“(%s – %s) spread – {{INTERVAL}} {{DATE}} \n%s -\nOpen %g \nHi %g \nLo %g \nClose %g \n\n%s -\nOpen %g \nHi %g \nLo %g \nClose %g”, Symbol1, Symbol2, Symbol1, O1, H1, L1, C1, Symbol2, O2, H2, L2, C2));

    Can you please help me confirm if my code for the SlAboutToHit is correct or not?

    Thanks a ton in advalnce!

    Regards,
    Mithilesh

Leave a Reply

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